<?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');
	// });

    


	/**
	* 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::get('addcountry/{data}', 'FetchController@addcountry');
			Route::get('addpoint/{data}', 'FetchController@addpoint');
			
			
			
			

			Route::post('/logout', 'LoginController@logout')->name('admin_logout');

			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');

                // PRODUCT ROUTES
                Route::put('/products/restore/{id}', 'ProductController@restore')->name('products.restore');
                Route::put('/products/restore', 'ProductController@restoreAll')->name('products.restoreAll');
                Route::delete('/products', 'ProductController@destroyAll')->name('products.destroyAll');
                Route::get('/products/grid', 'ProductController@grid')->name('products.grid');
                Route::resource('/products', 'ProductController');
                // 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');

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


                // Partner ROUTES
                Route::put('/partners/restore/{id}', 'PartnerController@restore')->name('partners.restore');
                Route::put('/partners/restore', 'PartnerController@restoreAll')->name('partners.restoreAll');
                Route::delete('/partners', 'PartnerController@destroyAll')->name('partners.destroyAll');
                Route::get('/partners/grid', 'PartnerController@grid')->name('partners.grid');
                Route::resource('/partners', 'PartnerController');
                
                // Service 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');
                

                // 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');
                
                
				// 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');
                
                
                // Contact 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');
                
                
                // Slider 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');
                
                
                // Mail 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');
                
                // Category 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');
                // Meal ROUTES
                Route::put('/meals/restore/{id}', 'MealController@restore')->name('meals.restore');
                Route::put('/meals/restore', 'MealController@restoreAll')->name('meals.restoreAll');
                Route::delete('/meals', 'MealController@destroyAll')->name('meals.destroyAll');
                Route::get('/meals/grid', 'MealController@grid')->name('meals.grid');
                Route::resource('/meals', 'MealController');
                // Review ROUTES
                Route::put('/reviews/restore/{id}', 'ReviewController@restore')->name('reviews.restore');
                Route::put('/reviews/restore', 'ReviewController@restoreAll')->name('reviews.restoreAll');
                Route::delete('/reviews', 'ReviewController@destroyAll')->name('reviews.destroyAll');
                Route::get('/reviews/grid', 'ReviewController@grid')->name('reviews.grid');
                Route::resource('/reviews', 'ReviewController');
                
               
			});  // End Role Routes


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

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

});
