<?php

use App\Http\Controllers\Web\AddressController;
use App\Http\Controllers\Web\AuthController;
use App\Http\Controllers\Web\CartController;
use App\Http\Controllers\Web\NewsletterController;
use App\Http\Controllers\Web\OrderController;
use App\Http\Controllers\Web\ProductController;
use App\Http\Controllers\Web\ProfileController;
use App\Http\Controllers\Web\VisitorMessageController;
use App\Http\Controllers\Web\HomeController;
use App\Http\Controllers\Web\PageController;
use Illuminate\Support\Facades\Route;
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;

/*
  |--------------------------------------------------------------------------
  | 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('language/{id}/{slug?}', 'LanguageController@details');

Route::group(['prefix' => LaravelLocalization::setLocale()], function () {

    Route::group(['middleware' => ['checkWebSiteEnabled', 'WebsiteVisitorCount']], function () {
        //Home
        Route::get('/', [HomeController::class,'index'])->name('web.home');
        

        Route::group(['middleware' => ['GuestAuth']], function () {
            
            Route::group(['prefix' => 'regist'], function () {
                Route::get('/phone', [AuthController::class,'registPhone'])->name('web.regist.phone');
                Route::post('/phone', [AuthController::class,'registPhoneCheck'])->name('web.regist.phone.check');
                Route::post('/verify/code', [AuthController::class,'verifyCodeCheck'])->name('web.verify.code');
                Route::get('/', [AuthController::class,'regist'])->name('web.regist');
                Route::post('/', [AuthController::class,'providerStore'])->name('web.regist.store');
            });
            
        });
       
    });
});
