Laravel API With Sanctum
Laravel API With Sanctum Install a Laravel project composer create-project laravel/laravel [my-project-name] Install the package Composer require laravel/sanctum Do the migration php artisan vendor:publish --provider=”Laravel\Sanctum\SanctumServiceProvider” php artisan migrate Replace the kernel.php -> middlewareGroups -> api 'api' => [ \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, 'throttle:api', \Illuminate\Routing\Middleware\SubstituteBindings::class, ], Add this to User model use Laravel\Sanctum\HasApiTokens; class User extends Authenticatable { use HasApiTokens, HasFactory, Notifiable;} Add this to api.php routes Route::group(['middleware' => ['auth:sanctum']], function () { Route::get('/emp...