56 lines
1.7 KiB
PHP
56 lines
1.7 KiB
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Route;
|
|
use Laravel\Fortify\Features;
|
|
use Livewire\Volt\Volt;
|
|
|
|
Route::get('/', function () {
|
|
return view('welcome');
|
|
})->name('home');
|
|
|
|
Route::get('/language/{locale}', function (string $locale) {
|
|
if (! in_array($locale, ['ar', 'en'])) {
|
|
abort(400);
|
|
}
|
|
|
|
session(['locale' => $locale]);
|
|
|
|
if (auth()->check()) {
|
|
auth()->user()->update(['preferred_language' => $locale]);
|
|
}
|
|
|
|
return redirect()->back();
|
|
})->name('language.switch');
|
|
|
|
Route::middleware(['auth', 'active'])->group(function () {
|
|
// Admin routes
|
|
Route::middleware('admin')->prefix('admin')->group(function () {
|
|
Route::view('/dashboard', 'livewire.admin.dashboard-placeholder')
|
|
->name('admin.dashboard');
|
|
});
|
|
|
|
// Client routes
|
|
Route::prefix('client')->group(function () {
|
|
Route::view('/dashboard', 'livewire.client.dashboard-placeholder')
|
|
->name('client.dashboard');
|
|
});
|
|
|
|
// Settings routes
|
|
Route::redirect('settings', 'settings/profile');
|
|
|
|
Volt::route('settings/profile', 'settings.profile')->name('profile.edit');
|
|
Volt::route('settings/password', 'settings.password')->name('user-password.edit');
|
|
Volt::route('settings/appearance', 'settings.appearance')->name('appearance.edit');
|
|
|
|
Volt::route('settings/two-factor', 'settings.two-factor')
|
|
->middleware(
|
|
when(
|
|
Features::canManageTwoFactorAuthentication()
|
|
&& Features::optionEnabled(Features::twoFactorAuthentication(), 'confirmPassword'),
|
|
['password.confirm'],
|
|
[],
|
|
),
|
|
)
|
|
->name('two-factor.show');
|
|
});
|