28 lines
907 B
PHP
28 lines
907 B
PHP
|
<?php
|
||
|
|
||
|
use App\Http\Controllers\ChatController;
|
||
|
use App\Http\Controllers\NewsController;
|
||
|
use App\Http\Controllers\ProfileController;
|
||
|
use Illuminate\Support\Facades\Route;
|
||
|
|
||
|
Route::get('/', function () {
|
||
|
if (auth()->check()) {
|
||
|
return redirect()->route('chat');
|
||
|
}
|
||
|
return redirect()->route('login');
|
||
|
});
|
||
|
|
||
|
Route::resource('news', NewsController::class)->except(['show']);
|
||
|
|
||
|
Route::middleware('auth')->group(function () {
|
||
|
Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
|
||
|
Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
|
||
|
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
|
||
|
Route::get('/chat', [ChatController::class, 'index'])->name('chat');
|
||
|
Route::post('/chat/send', [ChatController::class, 'sendMessage'])->name('chat.send');
|
||
|
});
|
||
|
|
||
|
|
||
|
|
||
|
require __DIR__.'/auth.php';
|