<?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'=> 'dashboard', '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('/main/{data}', 'FetchController@main');
            Route::get('/model/{data}', 'FetchController@model');
			Route::post('/logout', 'LoginController@logout')->name('admin_logout');

                Route::get('/type/{id}', 'FetchController@type');
                Route::get('/city/{id}', 'FetchController@city');
                Route::get('/attr/{id}', 'FetchController@attr');
                Route::get('/modelscat/{id}', 'FetchController@modelscat');
                
                Route::get('/addchoise/{id}', 'FetchController@addchoise');
                Route::get('/country/{id}', 'FetchController@country');
                Route::post('/orderdata', 'FetchController@orderdata');
                Route::post('/orderdatamodal', 'FetchController@orderdatamodal');
                
                Route::post('/productShow', 'ProductController@productShow');

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

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

                

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

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

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

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


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

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

                
                // logs ROUTES
                Route::put('/logs/restore/{id}', 'LogController@restore')->name('logs.restore');
                Route::put('/logs/restore', 'LogController@restoreAll')->name('logs.restoreAll');
                Route::delete('/logs', 'LogController@destroyAll')->name('logs.destroyAll');
                Route::get('/logs/grid', 'LogController@grid')->name('logs.grid');
                Route::resource('/logs', 'LogController');
                
                 // 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');
                
                
                 
                
                
                // Writer ROUTES
                // Route::put('/writers/restore/{id}', 'WriterController@restore')->name('writers.restore');
                // Route::put('/writers/restore', 'WriterController@restoreAll')->name('writers.restoreAll');
                // Route::delete('/writers', 'WriterController@destroyAll')->name('writers.destroyAll');
                // Route::get('/writers/grid', 'WriterController@grid')->name('writers.grid');
                // Route::resource('/writers', 'WriterController');
                
                
                 // Comment ROUTES
                Route::put('/comments/restore/{id}', 'CommentController@restore')->name('comments.restore');
                Route::put('/comments/restore', 'CommentController@restoreAll')->name('comments.restoreAll');
                Route::delete('/comments', 'CommentController@destroyAll')->name('comments.destroyAll');
                Route::get('/comments/grid', 'CommentController@grid')->name('comments.grid');
                Route::resource('/comments', 'CommentController');
                
                
                
                // videos ROUTES
                Route::put('/videos/restore/{id}', 'VideoController@restore')->name('videos.restore');
                Route::put('/videos/restore', 'VideoController@restoreAll')->name('videos.restoreAll');
                Route::delete('/videos', 'VideoController@destroyAll')->name('videos.destroyAll');
                Route::get('/videos/grid', 'VideoController@grid')->name('videos.grid');
                Route::resource('/videos', 'VideoController');
                // galleries 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');
                
                
                // Day ROUTES
                
                Route::put('/days/restore/{id}', 'DayController@restore')->name('days.restore');
                Route::put('/days/restore', 'DayController@restoreAll')->name('days.restoreAll');
                Route::delete('/days', 'DayController@destroyAll')->name('days.destroyAll');
                Route::get('/days/grid', 'DayController@grid')->name('days.grid');
                Route::resource('/days', 'DayController');
                Route::get('/showday/{id}','DayController@showday');
                
                
                // Bannervideos ROUTES
                Route::put('/bannervideos/restore/{id}', 'BannerVideoController@restore')->name('bannervideos.restore');
                Route::put('/bannervideos/restore', 'BannerVideoController@restoreAll')->name('bannervideos.restoreAll');
                Route::delete('/bannervideos', 'BannerVideoController@destroyAll')->name('bannervideos.destroyAll');
                Route::get('/bannervideos/grid', 'BannerVideoController@grid')->name('bannervideos.grid');
                Route::resource('/bannervideos', 'BannerVideoController');
                
                


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


			});  // End Role Routes


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

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

});
