api.php 805 B

12345678910111213141516171819202122232425
  1. <?php
  2. use Illuminate\Http\Request;
  3. use Illuminate\Support\Facades\Route;
  4. /*
  5. |--------------------------------------------------------------------------
  6. | API Routes
  7. |--------------------------------------------------------------------------
  8. |
  9. | Here is where you can register API routes for your application. These
  10. | routes are loaded by the RouteServiceProvider and all of them will
  11. | be assigned to the "api" middleware group. Make something great!
  12. |
  13. */
  14. Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
  15. return $request->user();
  16. });
  17. Route::post("/login", [\App\Http\Controllers\API\AuthController::class, "login"]);
  18. Route::middleware(['auth:sanctum'])->group(function () {
  19. Route::post("/logout", [\App\Http\Controllers\API\AuthController::class, "logout"]);
  20. });