“Laravel Sanctum” Respostas de código

Laravel Sanctum

composer require laravel/sanctum
Fragile Fish

Laravel Sanctum

php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"
Depressed Dotterel

Laravel Sanctum

use Illuminate\Http\Request;

Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    return $request->user();
});
Cooperative Crab

Laravel Sanctum

use App\Models\Sanctum\PersonalAccessToken;
use Laravel\Sanctum\Sanctum;

/**
 * Bootstrap any application services.
 *
 * @return void
 */
public function boot()
{
    Sanctum::usePersonalAccessTokenModel(PersonalAccessToken::class);
}
Cooperative Crab

Laravel Sanctum

axios.get('/sanctum/csrf-cookie').then(response => {
    // Login...
});
Cooperative Crab

Respostas semelhantes a “Laravel Sanctum”

Perguntas semelhantes a “Laravel Sanctum”

Procure respostas de código populares por idioma

Procurar outros idiomas de código