Mahdee Rajon  subception

File "auth.php"

Full Path: /var/www/html/back/routes/api/auth.php
File size: 719 bytes
MIME-type: text/x-php
Charset: utf-8

<?php

declare(strict_types=1);

use App\Http\Controllers\Api\V1\Auth\AuthController;
use Illuminate\Support\Facades\Route;

Route::prefix('/v1/')->group(function (): void {
    Route::post('login', [AuthController::class, 'login'])->name('login');
    Route::get('login', fn () => response()->json([
            'message' => 'Пожалуйста авторизуйтесь, чтобы получить доступ к этому ресурсу.'
        ], 401));
});

Route::group(['prefix' => '/v1/','middleware' => 'auth:sanctum'], function (): void {
    Route::post('logout', [AuthController::class, 'logout'])->name('logout');
    Route::get('profile', [AuthController::class, 'profile'])->name('profile');
});