<?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(['prefix' => 'laravel-filemanager', 'middleware' => ['web', 'admin_auth']], function () {
        \UniSharp\LaravelFilemanager\Lfm::routes();
    });



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


    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('fetchModels','FetchController@fetchModels')->name('admin.fetch.models');
            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');

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

            });  // End Role Routes


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

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

});
