<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
use App\State;
use App\Ad;
use App\Country;
use App\Agency;
use App\Favorite;
use App\User;
use App\Agent;
use App\City;
use App\Contact_query;
use App\Agent_legality;
use Carbon\Carbon;
use Illuminate\Http\Request;
use App\Media;
use App\Http\Requests;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Validator;
use Intervention\Image\Facades\Image;

// To clear the cache
Route::get('/clear-cache', function() {
    $exitCode = Artisan::call('cache:clear');
    return redirect()->route('home');
});

Route::get('/', ['as' => 'home', 'uses'=>'HomeController@index']);

Route::get('get-exchange-rates', ['as' => 'exchange-rate', 'uses'=>'AdsController@getExchangeRates']);



Route::get('profileview/{type}/{myid}', ['as' => 'profileview', 'uses'=>'UserController@viewprofiledetail']);
Route::get('privacy', ['as' => 'privacy', 'uses'=>'HomeController@privacy']);
Route::get('LanguageSwitch/{lang}', ['as' => 'switch_language', 'uses'=>'HomeController@switchLang']);
Route::get('makeuser', ['as' => 'makeuser', 'uses'=>'UserController@mycreate']);
//Listing page
Route::get('contact-us', ['as' => 'contact_us_page', 'uses'=>'HomeController@contactUs']);
Route::post('contact-us', ['uses'=>'HomeController@contactUsPost']);
Route::post('contact-agent', ['as' => 'contact_agent','uses'=>'HomeController@contactAgentPost']);

Route::get('facebook', ['as' => 'facebook', 'uses'=>'HomeController@facebook']);
Route::get('mapview', ['as' => 'mapview', 'uses'=>'AdsController@mapview']);
Route::post('geneio', ['as' => 'geneio', 'uses'=>'AdsController@indexme']);

Route::get('about-us', ['as' => 'about_us_page', 'uses'=>'HomeController@aboutUs']);

Route::get('packages', ['as' => 'packages', 'uses'=>'HomeController@packages']);
Route::get('sponsorship', ['as' => 'sponsorship', 'uses'=>'HomeController@sponsorship']);
Route::get('faq', ['as' => 'faq-page', 'uses'=>'HomeController@faq']);

Route::get('messaging', ['as' => 'messaging', 'uses'=>'HomeController@messaging']);

Route::get('page/{slug}', ['as' => 'single_page', 'uses'=>'PostController@showPage']);

Route::get('blog', ['as' => 'blog', 'uses'=>'PostController@blogIndex']);
Route::get('blog/{slug}', ['as' => 'blog_single', 'uses'=>'PostController@blogSingle']);
Route::get('blog/author/{id}', ['as' => 'author_blog_posts', 'uses'=>'PostController@authorPosts']);


Route::get('listing', ['as' => 'listing', 'uses'=>'AdsController@listing']);
Route::get('red', ['as' => 'red', 'uses'=>'AdsController@red']);
Route::post('userstoreagency', ['as' => 'userstoreagency', 'uses'=>'UserController@storeagency']);
Route::post('editstoreagency', ['as' => 'editstoreagency', 'uses'=>'UserController@updateagencie']);


Route::get('listingmodal', ['as' => 'lister', 'uses'=>'AdsController@listingModal']);

Route::get('caseylisting', ['as' => 'caseylisting', 'uses'=>'AdsController@caseylisting']);
Route::get('agents', ['as' => 'agents', 'uses'=>'AdsController@agents']);
Route::get('ad/{slug}', ['as' => 'single_ad', 'uses'=>'AdsController@singleAd']);
Route::get('report-ad/{slug}', ['as' => 'report_ad', 'uses'=>'AdsController@reportAd']);
Route::get('embedded/{slug}', ['as' => 'embedded_ad', 'uses'=>'AdsController@embeddedAd']);
Route::get('confirm/{token}', 'UserController@confirmNewUser');

Route::post('save-ad-as-favorite', ['as' => 'save_ad_as_favorite', 'uses'=>'UserController@saveAdAsFavorite']);
Route::post('report-post', ['as' => 'report_ads_pos', 'uses'=>'AdsController@reportAds']);
Route::post('reply-by-email', ['as' => 'reply_by_email_post', 'uses'=>'UserController@replyByEmailPost']);
Route::post('newsearcher2',['as' =>'newsearcher2', 'uses'=> 'ApiController@searchmapview']);

// Password reset routes...
Route::post('send-password-reset-link', ['as' => 'send_reset_link', 'uses'=>'UserController@postEmailResetPassword']);
Route::get('password-reset/{token}', ['as' => 'password_reset_url', 'uses' =>'UserController@passwordResetForm' ]);
Route::post('password-reset/{token}', [ 'uses' => 'UserController@passwordResetPost']);

Route::get('getimages/{ad_id}', 'AdsController@getPictures');

Auth::routes(['verify' => true]);

Route::post('send-to-provider', ['as' => 'send-to-provider', 'uses'=>'CustomController@sendToProvider']);

Route::get('notify-user', ['as' => 'notify-user', 'uses'=>'CustomController@notifySellers']);

// Increment Views
Route::get('add-view/{id}', ['as'=>'add-view', 'uses'=>'CustomController@addView']);

//Register Success Page
// Route::get('register-success', ['as'=>'register.success', 'uses'=>'CustomController@registerSuccess']);


//mobile Routes

Route::get('mPrivacy', ['as' => 'mPrivacy', 'uses'=>'HomeController@mPrivacy']);

Route::get('mAboutKupeza', ['as' => 'mAboutKupeza', 'uses'=>'HomeController@mAboutKupeza']);

Route::get('mfaq', ['as' => 'mfaq', 'uses'=>'HomeController@mfaq']);

Route::get('mhelp', ['as' => 'mhelp', 'uses'=>'HomeController@mhelp']);

Route::get('mhelp_selling', ['as' => 'mhelp_selling', 'uses'=>'HomeController@mhelp_selling']);
Route::get('mhelp_buying', ['as' => 'mhelp_buying', 'uses'=>'HomeController@mhelp_buying']);
Route::get('mhelp_agents', ['as' => 'mhelp_agents', 'uses'=>'HomeController@mhelp_agents']);
Route::get('mhelp_mobile', ['as' => 'mhelp_mobile', 'uses'=>'HomeController@mhelp_mobile']);
Route::get('mhelp_general', ['as' => 'mhelp_general', 'uses'=>'HomeController@mhelp_general']);

//Auth::routes();
// Password reset routes...



Route::post('get-sub-category-by-category', ['as'=>'get_sub_category_by_category', 'uses' => 'AdsController@getSubCategoryByCategory']);
Route::post('get-brand-by-category', ['as'=>'get_brand_by_category', 'uses' => 'AdsController@getBrandByCategory']);
Route::post('get-category-info', ['as'=>'get_category_info', 'uses' => 'AdsController@getParentCategoryInfo']);
Route::post('get-state-by-country', ['as'=>'get_state_by_country', 'uses' => 'AdsController@getStateByCountry']);
Route::post('get-city-by-state', ['as'=>'get_city_by_state', 'uses' => 'AdsController@getCityByState']);
Route::post('switch/product-view', ['as'=>'switch_grid_list_view', 'uses' => 'AdsController@switchGridListView']);
Route::get('/fav', function () {
    return view('home');
});

// Route::get('contact-provider/{id}', ['as'=>'contact-provider', 'uses' => 'CustomController@messageProvider']);
Route::group(['prefix'=>'login'], function(){
    //Native login route
    Route::get('/', ['as' => 'login', 'uses'=>'UserController@login']);
    Route::post('/', ['uses'=>'UserController@loginPost']);

    //Social login route

    Route::get('facebook', ['as' => 'facebook_redirect', 'uses'=>'SocialLogin@redirectFacebook']);
    Route::get('facebook-callback', ['as' => 'facebook_callback', 'uses'=>'SocialLogin@callbackFacebook']);

    Route::get('google', ['as' => 'google_redirect', 'uses'=>'SocialLogin@redirectGoogle']);
    Route::get('google-callback', ['as' => 'google_callback', 'uses'=>'SocialLogin@callbackGoogle']);

});

Route::resource('user', 'UserController');
Route::post('signup', ['as' => 'signup', 'uses' =>function (Request $request) { 
    
            $rules = [
            'first_name'    => 'required',
            'last_name' => 'required',
            'email'    => 'required|email|unique:users',
            'password'    => 'required|confirmed',
            'password_confirmation'    => 'required',
            'phone'    => 'required|numeric',
            'agree'    => 'required',
            'user_type'=> 'required',
            ];
            $verifification = str_random(200);
            //$this->validate($request, $rules);

            $validator = Validator::make($request->all(),$rules );


            if ($validator->fails()) {
                $errors = $validator->messages();
                  $countries = Country::all();

               //return  back()->withErrors(['name' => 'The name is required']);
                return view('theme.user_create', compact('countries','errors'));
 
            }
            $phone_number = $request->phone;
         $data = [
                'first_name'        => $request->first_name,
                'last_name'         => $request->last_name,
                'name'              => $request->first_name.' '.$request->last_name,
                'email'             => $request->email,
                'phone'             => $phone_number,
                'password'          => bcrypt($request->password),
                'user_type'         => $request->user_type,
                'active_status'         => '0',
                'activation_code'   => $verifification,
            ];
            

              $user_create = User::create($data);
              if ($user_create){
                  $user_create->first_name = $request->first_name;
                  $user_create->last_name = $request->last_name;
                  $user_create->phone = $phone_number;
                  $user_create->activation_code =$verifification;
                  //$user_create->token_updated_at = now();
                  $user_create->save();
   $comment = 'Hi, This test feedback.';
   $toEmail = $request->email;
   $data = array('comment'=>$comment,'confirmation'=>'https://kupeza.co.zm/confirm/'.$verifification);
   Mail::send('emails.reminder', $data, function($message) use ($toEmail, $comment)
                    {
                        $message->to($toEmail, 'Email Message')->subject('Verify Your Email Address');
                        $message->from('info@kupeza.co.zm','Kupeza Support Team');
                    }); 
            // return redirect(route('login'))->with('registration_success', trans('app.registration_success'));
            return view('theme.register_success')->with('registration_success', trans('app.registration_success'));
        } else {
            
            return back()->withInput()->with('error', trans('app.error_msg'));
        }

        

//process the request

    
          
    
}]);


//Dashboard Route
Route::group(['prefix'=>'dashboard', 'middleware' => 'dashboard'], function(){
    Route::get('/', ['as'=>'dashboard', 'uses' => 'DashboardController@dashboard']);
    Route::get('agents', ['as'=>'users', 'uses' => 'UserController@index']);
    Route::get('users-info/{id}', ['as'=>'user_info', 'uses' => 'UserController@userInfo']);
    Route::get('agency-info/{id}', ['as'=>'agent_info', 'uses' => 'UserController@profilesAgency']);
    Route::post('change-agent-status', ['as'=>'change_agent_status', 'uses' => 'UserController@changeagencyStatus']);
    Route::post('change-user-status', ['as'=>'change_user_status', 'uses' => 'UserController@changeStatus']);
    Route::get('user_ads', ['as'=>'user_ad', 'uses' => 'AdsController@userads']);
    Route::get('user_pend', ['as'=>'user_pend', 'uses' => 'AdsController@userpend']);
    Route::get('user_blocked', ['as'=>'user_blocked', 'uses' => 'AdsController@userblocked']);
    Route::get('tickets', ['as'=>'tickets', 'uses' => 'HomeController@tickets']);
    Route::post('change-user-feature', ['as'=>'change_user_feature', 'uses' => 'UserController@changeFeature']);
    Route::post('change-the-user-status', ['as'=>'change_the_user_status', 'uses' => 'UserController@changeUserStatus']);
    Route::post('change-agency-status', ['as'=>'change_agency_status', 'uses' => 'UserController@AgencyStatus']);
    Route::post('delete-reports', ['as'=>'delete_report', 'uses' => 'AdsController@deleteReports']);
    Route::get('users', ['as'=>'just-users', 'uses' => 'UserController@userIndex']);
    Route::get('agent-messages', ['as'=>'agent_messages', 'uses' => 'UserController@agentMessages']);
    Route::get('user-messages', ['as'=>'user_messages', 'uses' => 'UserController@userMessages']);
    Route::get('wordpress-key', ['as'=>'wordpress_key', 'uses' => 'CustomController@wordpressView']);
    Route::get('wordpress-generate', ['as'=>'wordpress_generate', 'uses' => 'CustomController@wordpressGenerate']);
    
    Route::get('mark-as-sold/{id}', ['as'=>'mark_as_sold', 'uses' => 'CustomController@markAsSold']);
    
    Route::get('add-agent-to-ad/{id}', ['as'=>'agent_add', 'uses' => 'AdsController@setAgent']);
    Route::get('agent-to-ad/{property_id}/{agent_id}', ['as'=>'set_agent_add', 'uses' => 'AdsController@setAgentToAd']);
    
    Route::get('manage-ad-invites', ['as'=>'ads_added_to', 'uses' => 'AdsController@addedToAdPage']);
    Route::get('accept-invite/{invite_id}/{answer}', ['as'=>'ad-accept-invite', 'uses' => 'AdsController@acceptAdInvite']);
    
    Route::group(['middleware'=>'only_admin_access'], function(){
        
        // Service Provider Routes
        Route::group(['prefix'=>'providers'], function(){
            Route::get('/all-providers', ['as'=>'all-providers', 'uses' => 'CustomController@serviceProvidersIndex']);
            Route::get('/providers-create', ['as'=>'providers_create', 'uses' => 'CustomController@serviceProvidersCreate']);
            Route::post('/providers-store', ['as'=>'providers_store', 'uses' => 'CustomController@serviceProvidersAdd']);
            Route::get('/providers-modify/{id}', ['as'=>'providers_modify', 'uses' => 'CustomController@serviceProvidersModify']);
            Route::post('/providers-edit/{id}', ['as'=>'providers_edit', 'uses' => 'CustomController@serviceProvidersEdit']);
        });
        
        
        
        Route::group(['prefix'=>'settings'], function(){
            Route::get('theme-settings', ['as'=>'theme_settings', 'uses' => 'SettingsController@ThemeSettings']);
            Route::get('modern-theme-settings', ['as'=>'modern_theme_settings', 'uses' => 'SettingsController@modernThemeSettings']);
            Route::get('social-url-settings', ['as'=>'social_url_settings', 'uses' => 'SettingsController@SocialUrlSettings']);
            Route::get('general', ['as'=>'general_settings', 'uses' => 'SettingsController@GeneralSettings']);
            Route::get('payments', ['as'=>'payment_settings', 'uses' => 'SettingsController@PaymentSettings']);
            Route::get('ad', ['as'=>'ad_settings', 'uses' => 'SettingsController@AdSettings']);
            Route::get('languages', ['as'=>'language_settings', 'uses' => 'LanguageController@index']);
            Route::get('agencies', ['as'=>'agencies', 'uses' => 'UserController@agencies']);
            Route::get('agency/{id}', ['as'=>'agency', 'uses' => 'UserController@agency']);
            
            Route::post('languages', ['uses' => 'LanguageController@store']);
            Route::post('languages-delete', ['as'=>'delete_language', 'uses' => 'LanguageController@destroy']);

            Route::get('storage', ['as'=>'file_storage_settings', 'uses' => 'SettingsController@StorageSettings']);
            Route::get('social', ['as'=>'social_settings', 'uses' => 'SettingsController@SocialSettings']);
            Route::get('blog', ['as'=>'blog_settings', 'uses' => 'SettingsController@BlogSettings']);
            Route::get('other', ['as'=>'other_settings', 'uses' => 'SettingsController@OtherSettings']);
            Route::post('other', ['as'=>'other_settings', 'uses' => 'SettingsController@OtherSettingsPost']);

            //Save settings / options
            Route::post('save-settings', ['as'=>'save_settings', 'uses' => 'SettingsController@update']);
            Route::get('monetization', ['as'=>'monetization', 'uses' => 'SettingsController@monetization']);
        });

        Route::group(['prefix'=>'location'], function(){
            Route::get('country', ['as'=>'country_list', 'uses' => 'LocationController@countries']);
            Route::get('states', ['as'=>'state_list', 'uses' => 'LocationController@stateList']);
            Route::post('states', [ 'uses' => 'LocationController@saveState']);
            Route::get('states/{id}/edit', ['as'=>'edit_state', 'uses' => 'LocationController@stateEdit']);
            Route::post('states/{id}/edit', ['uses' => 'LocationController@stateEditPost']);
            Route::post('states/delete', ['as'=>'delete_state', 'uses' => 'LocationController@stateDestroy']);
            Route::get('cities', ['as'=>'city_list', 'uses' => 'LocationController@cityList']);
            Route::post('cities', ['uses' => 'LocationController@saveCity']);

            Route::get('cities/{id}/edit', ['as'=>'edit_city', 'uses' => 'LocationController@cityEdit']);
            Route::post('cities/{id}/edit', ['uses' => 'LocationController@cityEditPost']);
            Route::post('city/delete', ['as'=>'delete_city', 'uses' => 'LocationController@cityDestroy']);
        });

        Route::group(['prefix'=>'categories'], function(){
            Route::get('/', ['as'=>'parent_categories', 'uses' => 'CategoriesController@index']);
            Route::post('/', ['uses' => 'CategoriesController@store']);

            Route::get('edit/{id}', ['as'=>'edit_categories', 'uses' => 'CategoriesController@edit']);
            Route::post('edit/{id}', ['uses' => 'CategoriesController@update']);

            Route::post('delete-categories', ['as'=>'delete_categories', 'uses' => 'CategoriesController@destroy']);
        });

        Route::group(['prefix'=>'distances'], function(){
            Route::get('/', ['as'=>'admin_brands', 'uses' => 'BrandsController@index']);
            Route::post('/', ['uses' => 'BrandsController@store']);
            Route::get('edit/{id}', ['as'=>'edit_brands', 'uses' => 'BrandsController@edit']);
            Route::post('edit/{id}', ['uses' => 'BrandsController@update']);
            Route::post('delete-distances', ['as'=>'delete_brands', 'uses' => 'BrandsController@destroy']);
        });

        Route::group(['prefix'=>'posts'], function(){
            Route::get('/', ['as'=>'posts', 'uses' => 'PostController@posts']);

            Route::get('create', ['as'=>'create_new_post', 'uses' => 'PostController@createPost']);
            Route::post('create', ['uses' => 'PostController@storePost']);
            Route::post('delete', ['as'=>'delete_post','uses' => 'PostController@destroyPost']);

            Route::get('edit/{slug}', ['as'=>'edit_post', 'uses' => 'PostController@editPost']);
            Route::post('edit/{slug}', ['uses' => 'PostController@updatePost']);

            Route::get('download/{file}', ['as'=>'download_cert', 'uses' => 'CustomController@downloadPdf']);
        });

        Route::group(['prefix'=>'pages'], function(){
            Route::get('/', ['as'=>'pages', 'uses' => 'PostController@index']);

            Route::get('create', ['as'=>'create_new_page', 'uses' => 'PostController@create']);
            Route::post('create', ['uses' => 'PostController@store']);
            Route::post('delete', ['as'=>'delete_page','uses' => 'PostController@destroy']);

            Route::get('edit/{slug}', ['as'=>'edit_page', 'uses' => 'PostController@edit']);
            Route::post('edit/{slug}', ['uses' => 'PostController@updatePage']);
        });

        Route::group(['prefix'=>'slider'], function(){
            Route::get('/', ['as'=>'slider', 'uses' => 'SliderController@index']);
            Route::get('create', ['as'=>'create_slider', 'uses' => 'SliderController@create']);
            Route::post('create', ['uses' => 'SliderController@store']);
            Route::post('crop', ['as'=>'create_crop', 'uses' => 'SliderController@postCrop']);
            Route::post('delete', ['as'=>'delete_slider', 'uses' => 'SliderController@destroy']);
            Route::post('update-caption', ['as'=>'update_slider_caption', 'uses' => 'SliderController@update']);
        });
        
        

        Route::get('approved', ['as'=>'approved_ads', 'uses' => 'AdsController@index']);
        Route::get('pending', ['as'=>'admin_pending_ads', 'uses' => 'AdsController@adminPendingAds']);
        Route::get('blocked', ['as'=>'admin_blocked_ads', 'uses' => 'AdsController@adminBlockedAds']);
        Route::post('status-change', ['as'=>'ads_status_change', 'uses' => 'AdsController@adStatusChange']);

        Route::get('ad-reports', ['as'=>'ad_reports', 'uses' => 'AdsController@reports']);
        Route::get('contact-messages', ['as'=>'contact_messages', 'uses' => 'HomeController@contactMessages']);

        

        Route::group(['prefix'=>'administrators'], function(){
            Route::get('/', ['as'=>'administrators', 'uses' => 'UserController@administrators']);
            Route::get('create', ['as'=>'add_administrator', 'uses' => 'UserController@addAdministrator']);
            Route::post('create', ['uses' => 'UserController@storeAdministrator']);

            Route::post('block-unblock', ['as'=>'administratorBlockUnblock','uses' => 'UserController@administratorBlockUnblock']);

        });

    });

    //All user can access this route
    Route::get('payments', ['as'=>'payments', 'uses' => 'PaymentController@index']);
    Route::get('payments-info/{trand_id}', ['as'=>'payment_info', 'uses' => 'PaymentController@paymentInfo']);
    //End all users access


    Route::group(['prefix'=>'u'], function(){
        Route::group(['prefix'=>'posts'], function(){
            Route::get('/', ['as'=>'my_ads', 'uses' => 'AdsController@myAds']);
            Route::get('create', ['as'=>'create_ad', 'uses' => 'AdsController@create']);
            Route::post('create', ['uses' => 'AdsController@store']);
            Route::post('create_agency', ['as' => 'create_agency', 'uses' => 'UserController@CreateAgency']);
            Route::post('delete', ['as'=>'delete_ads', 'uses' => 'AdsController@destroy']);
            Route::get('edit/{id}', ['as'=>'edit_ad', 'uses' => 'AdsController@edit']);
            Route::get('agency/edit/{id}', ['as'=>'agency_edit_ad', 'uses' => 'AdsController@editagprop']);
            Route::post('agency/edit/{id}', ['uses' => 'AdsController@agencyupdate']);
            Route::post('edit/{id}', ['uses' => 'AdsController@update']);
            Route::get('my-lists', ['as'=>'my_ads', 'uses' => 'AdsController@myAds']);
            Route::get('favorite-lists', ['as'=>'favorite_ads', 'uses' => 'AdsController@favoriteAds']);
            //Upload ads image
            Route::post('upload-a-image', ['as'=>'upload_ads_image', 'uses' => 'AdsController@uploadAdsImage']);
            Route::post('upload-post-image', ['as'=>'upload_post_image', 'uses' => 'PostController@uploadPostImage']);
            //Delete media
            Route::post('delete-media', ['as'=>'delete_media', 'uses' => 'AdsController@deleteMedia']);
            Route::post('feature-media-creating', ['as'=>'feature_media_creating_ads', 'uses' => 'AdsController@featureMediaCreatingAds']);
            Route::get('append-media-image', ['as'=>'append_media_image', 'uses' => 'AdsController@appendMediaImage']);
            Route::get('append-post-media-image', ['as'=>'append_post_media_image', 'uses' => 'PostController@appendPostMediaImage']);
            Route::get('pending-lists', ['as'=>'pending_ads', 'uses' => 'AdsController@pendingAds']);
            Route::get('archive-lists', ['as'=>'favourite_ad', 'uses' => 'AdsController@FavoriteAds']);
            //Checkout payment
            Route::get('checkout/{transaction_id}', ['as'=>'payment_checkout', 'uses' => 'PaymentController@checkout']);
            Route::post('checkout/{transaction_id}', ['uses' => 'PaymentController@chargePayment']);
            //Payment success url
            Route::post('checkout/{transaction_id}/payment-success', ['as'=>'payment_success_url','uses' => 'PaymentController@paymentSuccess']);
            Route::post('checkout/{transaction_id}/paypal-notify', ['as'=>'paypal_notify_url','uses' => 'PaymentController@paypalNotify']);
            Route::get('reports-by/{slug}', ['as'=>'reports_by_ads', 'uses' => 'AdsController@reportsByAds']);
            Route::get('profile', ['as'=>'profile', 'uses' => 'UserController@profile']);
            Route::get('profile/edit', ['as'=>'profile_edit', 'uses' => 'UserController@profileEdit']);
            Route::post('profile/edit', ['as' => 'profit_edit', 'uses' => 'UserController@profileEditPost']);
            Route::get('agency/edit', ['as'=>'agency_edit', 'uses' => 'UserController@agencieEdit']);
            Route::get('agency/create', ['as'=>'agency_create', 'uses' => 'UserController@agenciesaver']);
            Route::get('agency/agents', ['as'=>'agency_agents', 'uses' => 'UserController@agencyindex']);
            Route::get('agency/blocked', ['as'=>'agency_blocked', 'uses' => 'UserController@agencyblocked']);
            Route::get('agency/pending', ['as'=>'agency_pending', 'uses' => 'UserController@agencypending']);
            Route::get('agency/ads', ['as'=>'agency_ads', 'uses' => 'AdsController@agencyAds']);
            Route::get('agency/pendingads', ['as'=>'agency_pending_ads', 'uses' => 'AdsController@pendingagencyAds']);
            Route::get('agency/createads', ['as'=>'agency_create_ad', 'uses' => 'AdsController@createad']);
            Route::post('agency/savead', ['as'=>'savead','uses' => 'AdsController@agencystore']);
            Route::get('agent/select', ['as'=>'selectagency','uses' => 'UserController@selectAgency']);
            Route::get('agent/agency', ['as'=>'agencyprofile','uses' => 'UserController@profilesAgency']);
            Route::get('agency/status', ['as'=>'agency_status', 'uses' => 'UserController@AgencyStatus']);
            Route::get('profile/change-avatar', ['as'=>'change_avatar', 'uses' => 'UserController@changeAvatar']);
            Route::post('upload-avatar', ['as'=>'upload_avatar',  'uses' => 'UserController@uploadAvatar']);

            /**
             * Change Password route
             */
            Route::group(['prefix' => 'account'], function() {
                Route::get('change-password', ['as' => 'change_password', 'uses' => 'UserController@changePassword']);
                Route::post('change-password', 'UserController@changePasswordPost');
            });


        });
    });

    Route::get('logout', ['as'=>'logout', 'uses' => 'DashboardController@logout']);
});
