Skip to content

Instantly share code, notes, and snippets.

@silkyland
Created February 20, 2021 11:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save silkyland/1debff211295255ca4351c884bb4fa08 to your computer and use it in GitHub Desktop.
Save silkyland/1debff211295255ca4351c884bb4fa08 to your computer and use it in GitHub Desktop.
Api Auth Login, register, me, logout
<?php
use App\Http\Controllers\AuthController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::post('/login', [AuthController::class, 'apiLogin']);
Route::post('/register', [AuthController::class, 'apiRegister']);
Route::middleware('auth:sanctum')->post('/logout', [AuthController::class, 'apiLogout']);
Route::middleware('auth:sanctum')->get('/me', [AuthController::class, 'me']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment