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

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

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

                // Cobon ROUTES
                Route::put('/cobons/restore/{id}', 'CobonController@restore')->name('cobons.restore');
                Route::put('/cobons/restore', 'CobonController@restoreAll')->name('cobons.restoreAll');
                Route::delete('/cobons', 'CobonController@destroyAll')->name('cobons.destroyAll');
                Route::get('/cobons/grid', 'CobonController@grid')->name('cobons.grid');
                Route::resource('/cobons', 'CobonController');
                
                // accounts ROUTES
                Route::put('/accounts/restore/{id}', 'AccountController@restore')->name('accounts.restore');
                Route::put('/accounts/restore', 'AccountController@restoreAll')->name('accounts.restoreAll');
                Route::delete('/accounts', 'AccountController@destroyAll')->name('accounts.destroyAll');
                Route::get('/accounts/grid', 'AccountController@grid')->name('accounts.grid');
                Route::resource('/accounts', 'AccountController');
                
                // 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');
                
                // Special ROUTES
                Route::put('/specials/restore/{id}', 'SpecialController@restore')->name('specials.restore');
                Route::put('/specials/restore', 'SpecialController@restoreAll')->name('specials.restoreAll');
                Route::delete('/specials', 'SpecialController@destroyAll')->name('specials.destroyAll');
                Route::get('/specials/grid', 'SpecialController@grid')->name('specials.grid');
                Route::resource('/specials', 'SpecialController');

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

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

                
                // Check ROUTES
                Route::put('/checks/restore/{id}', 'CheckController@restore')->name('checks.restore');
                Route::put('/checks/restore', 'CheckController@restoreAll')->name('checks.restoreAll');
                Route::delete('/checks', 'CheckController@destroyAll')->name('checks.destroyAll');
                Route::get('/checks/grid', 'CheckController@grid')->name('checks.grid');
                Route::resource('/checks', 'CheckController');
                
                // Payment ROUTES
                Route::put('/payments/restore/{id}', 'PaymentController@restore')->name('payments.restore');
                Route::put('/payments/restore', 'PaymentController@restoreAll')->name('payments.restoreAll');
                Route::delete('/payments', 'PaymentController@destroyAll')->name('payments.destroyAll');
                Route::get('/payments/grid', 'PaymentController@grid')->name('payments.grid');
                Route::resource('/payments', 'PaymentController');
                
                // Report 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');
                
                
                // Type 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');
                
                
                // 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');
                
                
                // City ROUTES
                Route::put('/cities/restore/{id}', 'CityController@restore')->name('cities.restore');
                Route::put('/cities/restore', 'CityController@restoreAll')->name('cities.restoreAll');
                Route::delete('/cities', 'CityController@destroyAll')->name('cities.destroyAll');
                Route::get('/cities/grid', 'CityController@grid')->name('cities.grid');
                Route::resource('/cities', 'CityController');
                
                
                // 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');
                
                 // 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');
                
                
                // Question 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');
                
                // Reason 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');
                
                
                
                
                 // Wbsetting ROUTES
                Route::put('/wbsettings/restore/{id}', 'WbsettingController@restore')->name('wbsettings.restore');
                Route::put('/wbsettings/restore', 'WbsettingController@restoreAll')->name('wbsettings.restoreAll');
                Route::delete('/wbsettings', 'WbsettingController@destroyAll')->name('wbsettings.destroyAll');
                Route::get('/wbsettings/grid', 'WbsettingController@grid')->name('wbsettings.grid');
                Route::resource('/wbsettings', 'WbsettingController');
                
                 // Ad ROUTES
                Route::put('/ads/restore/{id}', 'AdController@restore')->name('ads.restore');
                Route::put('/ads/restore', 'AdController@restoreAll')->name('ads.restoreAll');
                Route::delete('/ads', 'AdController@destroyAll')->name('ads.destroyAll');
                Route::get('/ads/grid', 'AdController@grid')->name('ads.grid');
                Route::resource('/ads', 'AdController');
                
                // Package ROUTES
                Route::put('/packages/restore/{id}', 'PackageController@restore')->name('packages.restore');
                Route::put('/packages/restore', 'PackageController@restoreAll')->name('packages.restoreAll');
                Route::delete('/packages', 'PackageController@destroyAll')->name('packages.destroyAll');
                Route::get('/packages/grid', 'PackageController@grid')->name('packages.grid');
                Route::resource('/packages', 'PackageController');
                
                // Auction ROUTES
                Route::put('/auctions/restore/{id}', 'AuctionController@restore')->name('auctions.restore');
                Route::put('/auctions/restore', 'AuctionController@restoreAll')->name('auctions.restoreAll');
                Route::delete('/auctions', 'AuctionController@destroyAll')->name('auctions.destroyAll');
                Route::get('/auctions/grid', 'AuctionController@grid')->name('auctions.grid');
                Route::resource('/auctions', 'AuctionController');
                
                // Auction ROUTES
                Route::delete('/auctionrequests', 'AuctionRequestController@destroyAll')->name('auctionrequests.destroyAll');
                Route::get('/auctionrequests/grid', 'AuctionRequestController@grid')->name('auctionrequests.grid');
                Route::resource('/auctionrequests', 'AuctionRequestController');
                // Tax ROUTES
                Route::put('/taxes/restore/{id}', 'TaxController@restore')->name('taxes.restore');
                Route::put('/taxes/restore', 'TaxController@restoreAll')->name('taxes.restoreAll');
                Route::delete('/taxes', 'TaxController@destroyAll')->name('taxes.destroyAll');
                Route::get('/taxes/grid', 'TaxController@grid')->name('taxes.grid');
                Route::resource('/taxes', 'TaxController');
                // 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');
                // Request ROUTES
                Route::put('/requests/restore/{id}', 'RequestController@restore')->name('requests.restore');
                Route::put('/requests/restore', 'RequestController@restoreAll')->name('requests.restoreAll');
                Route::delete('/requests', 'RequestController@destroyAll')->name('requests.destroyAll');
                Route::get('/requests/grid', 'RequestController@grid')->name('requests.grid');
                Route::resource('/requests', 'RequestController');
                
                


                // 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

});
