<?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!
|
*/

use App\Http\Middleware\CheckWebSiteEnabled;

Route::get('language/{id}/{slug?}', 'LanguageController@details');
/**
* Localization Group
*/

Route::group(['prefix' => LaravelLocalization::setLocale()], function(){

	// Route::get('/', function () {
	//     // return redirect('/admin/login');
	// });

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

        Route::get('/pages', 'PageController@index')->name('pages');
        Route::get('/pages/{page}/{slug?}', 'PageController@details')->name('page_details');

        // Route::get('/articles/categories', 'ArticleController@categories')->name('articles_categories');
        // Route::get('/articles/{category}/{slug?}', 'ArticleController@index')->name('articles');
        // Route::get('/article/{article}/{slug?}', 'ArticleController@details')->name('article_details');

    });



	/**
	* this route for the central admin and central super admin to enable them to use this website
	*/
	Route::get('/login/{admin_token}', 'Auth\LoginController@super_admin_login')->name('super_admin_login');

	/**
	* Authentication routes , and Authentication user routs
	*/
	Auth::routes();

	Route::get('/home', 'HomeController@index')->name('home');
	/**
	* Admin Routes
	*/
	Route::group([ 'prefix'=> 'admin', 'namespace' => 'Admin'], function () {

		Route::get('/login', 'LoginController@index');
		Route::post('/login', 'LoginController@authenticate')->name('admin_login');

		Route::group([ 'middleware' => ['admin_auth']], function () {
			Route::get('/', 'DashboardController@index')->name('dashboard');

			Route::post('/logout', 'LoginController@logout')->name('admin_logout');
                Route::get('/addvision/{id}', 'FetchController@addvision');
                Route::get('/addmission/{id}', 'FetchController@addmission');
                
            Route::get('/addexperience/{num}', 'FetchController@addexperience');
            Route::get('/addcertification/{num}', 'FetchController@addcertification');
            Route::get('/typeselect/{id}', 'FetchController@typeselect');
            

                Route::get('/type/{id}', 'FetchController@type');
			Route::group([ 'middleware' => ['checkRole']], function () {


                // USER ROUTES
                Route::put('/users/restore/{id}', 'UserController@restore')->name('users.restore');
                Route::put('/users/restore', 'UserController@restoreAll')->name('users.restoreAll');
                Route::delete('/users', 'UserController@destroyAll')->name('users.destroyAll');
                Route::get('/users/grid', 'UserController@grid')->name('users.grid');
                Route::resource('/users', 'UserController');
                
                // members ROUTES
                Route::put('/members/restore/{id}', 'MemberController@restore')->name('members.restore');
                Route::put('/members/restore', 'MemberController@restoreAll')->name('members.restoreAll');
                Route::delete('/members', 'MemberController@destroyAll')->name('members.destroyAll');
                Route::get('/members/grid', 'MemberController@grid')->name('members.grid');
                Route::resource('/members', 'MemberController');
                

                // reasons ROUTES
                Route::put('/reasons/restore/{id}', 'ReasonController@restore')->name('reasons.restore');
                Route::put('/reasons/restore', 'ReasonController@restoreAll')->name('reasons.restoreAll');
                Route::delete('/reasons', 'ReasonController@destroyAll')->name('reasons.destroyAll');
                Route::get('/reasons/grid', 'ReasonController@grid')->name('reasons.grid');
                Route::resource('/reasons', 'ReasonController');
                
                
                // mails ROUTES
                Route::put('/mails/restore/{id}', 'MailController@restore')->name('mails.restore');
                Route::put('/mails/restore', 'MailController@restoreAll')->name('mails.restoreAll');
                Route::delete('/mails', 'MailController@destroyAll')->name('mails.destroyAll');
                Route::get('/mails/grid', 'MailController@grid')->name('mails.grid');
                Route::resource('/mails', 'MailController');
                
                
                // contacts ROUTES
                Route::put('/contacts/restore/{id}', 'ContactController@restore')->name('contacts.restore');
                Route::put('/contacts/restore', 'ContactController@restoreAll')->name('contacts.restoreAll');
                Route::delete('/contacts', 'ContactController@destroyAll')->name('contacts.destroyAll');
                Route::get('/contacts/grid', 'ContactController@grid')->name('contacts.grid');
                Route::resource('/contacts', 'ContactController');
                
                
                // articles ROUTES
                Route::put('/articles/restore/{id}', 'ArticleController@restore')->name('articles.restore');
                Route::put('/articles/restore', 'ArticleController@restoreAll')->name('articles.restoreAll');
                Route::delete('/articles', 'ArticleController@destroyAll')->name('articles.destroyAll');
                Route::get('/articles/grid', 'ArticleController@grid')->name('articles.grid');
                Route::resource('/articles', 'ArticleController');
                
                
                // Country ROUTES
                Route::put('/countries/restore/{id}', 'CountryController@restore')->name('countries.restore');
                Route::put('/countries/restore', 'CountryController@restoreAll')->name('countries.restoreAll');
                Route::delete('/countries', 'CountryController@destroyAll')->name('countries.destroyAll');
                Route::get('/countries/grid', 'CountryController@grid')->name('countries.grid');
                Route::resource('/countries', 'CountryController');
                
                
                // rates ROUTES
                Route::put('/rates/restore/{id}', 'RateController@restore')->name('rates.restore');
                Route::put('/rates/restore', 'RateController@restoreAll')->name('rates.restoreAll');
                Route::delete('/rates', 'RateController@destroyAll')->name('rates.destroyAll');
                Route::get('/rates/grid', 'RateController@grid')->name('rates.grid');
                Route::resource('/rates', 'RateController');
                
                
                
                // notifications ROUTES
                Route::put('/notifications/restore/{id}', 'NotificationController@restore')->name('notifications.restore');
                Route::put('/notifications/restore', 'NotificationController@restoreAll')->name('notifications.restoreAll');
                Route::delete('/notifications', 'NotificationController@destroyAll')->name('notifications.destroyAll');
                Route::get('/notifications/grid', 'NotificationController@grid')->name('notifications.grid');
                Route::resource('/notifications', 'NotificationController');
                
                
                
                // types ROUTES
                Route::put('/types/restore/{id}', 'TypeController@restore')->name('types.restore');
                Route::put('/types/restore', 'TypeController@restoreAll')->name('types.restoreAll');
                Route::delete('/types', 'TypeController@destroyAll')->name('types.destroyAll');
                Route::get('/types/grid', 'TypeController@grid')->name('types.grid');
                Route::resource('/types', 'TypeController');
                
                
                // categories ROUTES
                Route::put('/categories/restore/{id}', 'CategoryController@restore')->name('categories.restore');
                Route::put('/categories/restore', 'CategoryController@restoreAll')->name('categories.restoreAll');
                Route::delete('/categories', 'CategoryController@destroyAll')->name('categories.destroyAll');
                Route::get('/categories/grid', 'CategoryController@grid')->name('categories.grid');
                Route::resource('/categories', 'CategoryController');
                
                
                // PAGES ROUTES
                Route::put('/pages/restore/{id}', 'PageController@restore')->name('pages.restore');
                Route::put('/pages/restore', 'PageController@restoreAll')->name('pages.restoreAll');
                Route::delete('/pages', 'PageController@destroyAll')->name('pages.destroyAll');
                Route::get('/pages/grid', 'PageController@grid')->name('pages.grid');
                Route::resource('/pages', 'PageController');
                
                // channels ROUTES
                Route::put('/channels/restore/{id}', 'ChannelController@restore')->name('channels.restore');
                Route::put('/channels/restore', 'ChannelController@restoreAll')->name('channels.restoreAll');
                Route::delete('/channels', 'ChannelController@destroyAll')->name('channels.destroyAll');
                Route::get('/channels/grid', 'ChannelController@grid')->name('channels.grid');
                Route::resource('/channels', 'ChannelController');
                
                
                // questions ROUTES
                Route::put('/questions/restore/{id}', 'QuestionController@restore')->name('questions.restore');
                Route::put('/questions/restore', 'QuestionController@restoreAll')->name('questions.restoreAll');
                Route::delete('/questions', 'QuestionController@destroyAll')->name('questions.destroyAll');
                Route::get('/questions/grid', 'QuestionController@grid')->name('questions.grid');
                Route::resource('/questions', 'QuestionController');
                
                // reports ROUTES
                Route::put('/reports/restore/{id}', 'ReportController@restore')->name('reports.restore');
                Route::put('/reports/restore', 'ReportController@restoreAll')->name('reports.restoreAll');
                Route::delete('/reports', 'ReportController@destroyAll')->name('reports.destroyAll');
                Route::get('/reports/grid', 'ReportController@grid')->name('reports.grid');
                Route::resource('/reports', 'ReportController');
                // sliders ROUTES
                Route::put('/sliders/restore/{id}', 'SliderController@restore')->name('sliders.restore');
                Route::put('/sliders/restore', 'SliderController@restoreAll')->name('sliders.restoreAll');
                Route::delete('/sliders', 'SliderController@destroyAll')->name('sliders.destroyAll');
                Route::get('/sliders/grid', 'SliderController@grid')->name('sliders.grid');
                Route::resource('/sliders', 'SliderController');
                
                 // reasons ROUTES
                Route::put('/reasons/restore/{id}', 'ReasonController@restore')->name('reasons.restore');
                Route::put('/reasons/restore', 'ReasonController@restoreAll')->name('reasons.restoreAll');
                Route::delete('/reasons', 'ReasonController@destroyAll')->name('reasons.destroyAll');
                Route::get('/reasons/grid', 'ReasonController@grid')->name('reasons.grid');
                Route::resource('/reasons', 'ReasonController');
                
                // services ROUTES
                Route::put('/services/restore/{id}', 'ServiceController@restore')->name('services.restore');
                Route::put('/services/restore', 'ServiceController@restoreAll')->name('services.restoreAll');
                Route::delete('/services', 'ServiceController@destroyAll')->name('services.destroyAll');
                Route::get('/services/grid', 'ServiceController@grid')->name('services.grid');
                Route::resource('/services', 'ServiceController');
                

                // reservations ROUTES
                Route::put('/reservations/restore/{id}', 'ReservationController@restore')->name('reservations.restore');
                Route::put('/reservations/restore', 'ReservationController@restoreAll')->name('reservations.restoreAll');
                Route::delete('/reservations', 'ReservationController@destroyAll')->name('reservations.destroyAll');
                Route::get('/reservations/grid', 'ReservationController@grid')->name('reservations.grid');
                Route::resource('/reservations', 'ReservationController');

				// SETTING ROUTES
               	// Route::get('/settings', 'DashboardController@index')->name('admin_settings');
                Route::get('/settings', 'SettingController@index')->name('settings.index');
                Route::post('/settings', 'SettingController@store')->name('settings.store');
                Route::post('/modules-settings', 'SettingController@modules')->name('settings.modules');


			});  // End Role Routes


			Route::resource('/languages', 'LanguageController');
			// Route::post('/languages/{id}', 'LanguageController@update')->name('languages');

		}); // End Authenticated Admin routes
	}); // End Admin Routes

});
