<?php

//use Illuminate\Support\Facades\Route;

/*
  |--------------------------------------------------------------------------
  | Web Routes
  |--------------------------------------------------------------------------
  |
  | Here is where you can register web routes for your application. These
  | routes are loaded by the RouteServiceProvider within a group which
  | contains the "web" middleware group. Now create something great!
  |
 */

//Route::get('language/{id}/{slug?}', 'LanguageController@details');
/**
 * Localization Group
 */
Route::group(['prefix' => LaravelLocalization::setLocale()], function () {

    Route::group(['namespace' => 'Web', 'middleware' => ['checkWebSiteEnabled', 'WebsiteVisitorCount']], function () {
        //Home
        Route::get('/', 'HomeController@index')->name('home');

        //Page
        Route::get('/aboutus', 'PageController@aboutus')->name('aboutus');
        Route::get('/contactus', 'PageController@contactus')->name('contactus');
        Route::post('/contactus', 'PageController@contact')->name('contacting');
        Route::get('/conditions', 'PageController@conditions')->name('conditions');
        Route::get('/privacy', 'PageController@privacy')->name('privacy');

        Route::get('/services', 'ServiceController@index')->name('services');
        Route::get('/partners', 'PartnerController@index')->name('partners');

        Route::resource('/courses', 'CourseController')->only('index','show');

        Route::get('/news', 'NewController@index')->name('news');

        Route::group(['middleware' => [ 'GuestAuth'] ], function ()
        {
            //Auth Request
            Route::get('login','AuthController@login')->name('login');
            Route::post('login','AuthController@check')->name('login_check');

            Route::get('forgetpassword','AuthController@forgetpassword')->name('forgetpassword');
            Route::post('forgetpassword','AuthController@forgettingpassword')->name('forgettingpassword');

            Route::get('verify/code','AuthController@verify')->name('verify');
            Route::post('verify/code','AuthController@verifying')->name('verifying');

            Route::get('resetpassword','AuthController@resetpassword')->name('resetpassword');
            Route::post('resetpassword','AuthController@resetting')->name('resetting');

            Route::get('regist','AuthController@regist')->name('regist');
            Route::post('regist','AuthController@registing')->name('registing');
        });

        Route::group(['middleware' => [ 'AuthLogin'] ], function ()
        {
            Route::get('profile','ProfileController@profile')->name('profile');
            Route::post('profile','ProfileController@editProfile')->name('edit_profile');
            Route::get('logout','AuthController@logout')->name('logout');
            Route::get('/courses/apply/{id}', 'CourseController@applyCourse')->name('apply_course');
            Route::post('/courses/apply/{id}', 'CourseController@applyingCourse')->name('applying.course');
            Route::get('/courses/apply/complete/{id}', 'CourseController@completeCourse')->name('complete_course');
            Route::post('/courses/apply/complete/{id}', 'CourseController@completingCourse')->name('completing_course');

        });

    });

});
