“Sanctum Laravel” Kode Jawaban

Sanctum Laravel

composer require laravel/sanctum
Fragile Fish

Sanctum Laravel

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

Jawaban yang mirip dengan “Sanctum Laravel”

Pertanyaan yang mirip dengan “Sanctum Laravel”

Lebih banyak jawaban terkait untuk “Sanctum Laravel” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya