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

Route::get('/clear-all', function() {
    Artisan::call('cache:clear');
    Artisan::call('view:clear');
    Artisan::call('clear-compiled');
    Artisan::call('config:cache');
    Artisan::call('config:clear');
    return "All is cleared";
}); 

Auth::routes(); 

//Admin
Route::get('/', [App\Http\Controllers\AdminAuth\LoginController::class,'showLoginForm']);
Route::post('/create-login', [App\Http\Controllers\AdminAuth\LoginController::class,'login'])->name('create-login');
Route::post('admin-logout', [App\Http\Controllers\AdminAuth\LoginController::class,'logout'])->name('admin-logout');
Route::group(['middleware' => ['admin']], function() {
    Route::get('/admin/dashboard', [App\Http\Controllers\Admin\AdminController::class,'dashboard']);
    Route::get('/admin/dashboard/load_country_list/{text}', [App\Http\Controllers\Admin\AdminController::class,'load_country_list']); 
}); 

Route::get(
    'modal/{name}',
     'ModalController@get'
    )->name('modal-get');
Route::post(
    'modal/{name}',
     'ModalController@post'
     )->name('modal-post');

Route::get(
	'ajax/{name}',
	'AjaxController@get'
)->name('ajax-get');

Route::post(
	'ajax/{name}',
	'AjaxController@post'
)->name('ajax-post');

Route::get(
    'sub-content/{name}', [App\Http\Controllers\Admin\SubContentController::class, 'get']
)->name('sub-content');

 



