<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\HomeController;


Route::get('change-lang/{locale}', function ($locale) {
    Session::put('locale', $locale);
    return Redirect::back();
});

Route::get('', [HomeController::class, 'index'])->name('home');

Route::get('privacy-policy', [HomeController::class, 'privacyPolicy'])->name('privacyPolicy');
Route::get('about', [HomeController::class, 'about'])->name('about');
Route::get('contact', [HomeController::class, 'contact'])->name('contact');
Route::post('update-article-count', [HomeController::class, 'updateArticleCount'])->name('updateArticleCount');

Route::get('category/chiangmai', [HomeController::class, 'category'])->name('category');
Route::get('category/chiangmai/article/{subCateId}', [HomeController::class, 'article'])->name('article');
Route::get('category/chiangmai/article-detail/{id}', [HomeController::class, 'articleDetail'])->name('articleDetail');

Route::get('category/where-else', [HomeController::class, 'categoryWhereElse'])->name('categoryWhereElse');
Route::get('category/where-else/article/{subCateId}/{fromDate?}/{toDate?}', [HomeController::class, 'articleWhereElse'])->name('articleWhereElse');
Route::get('category/where-else/article-detail/{id}', [HomeController::class, 'articleDetailWhereElse'])->name('articleDetailWhereElse');

Route::get('article', [HomeController::class, 'articleAll'])->name('articleAll');