From f7e5c172773842b6e37e8051516623fa03ab04a2 Mon Sep 17 00:00:00 2001 From: Hafez Divandari Date: Fri, 23 May 2025 18:49:44 +0330 Subject: [PATCH 1/3] fix a typo --- upgrade.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/upgrade.md b/upgrade.md index 2c3ddb3e30..88af28d3c1 100644 --- a/upgrade.md +++ b/upgrade.md @@ -160,10 +160,10 @@ The `Schema::getTables()`, `Schema::getViews()`, and `Schema::getTypes()` method $tables = Schema::getTables(); // All tables on the 'main' schema... -$table = Schema::getTables(schema: 'main'); +$tables = Schema::getTables(schema: 'main'); // All tables on the 'main' and 'blog' schemas... -$table = Schema::getTables(schema: ['main', 'blog']); +$tables = Schema::getTables(schema: ['main', 'blog']); ``` The `Schema::getTableListing()` method now returns schema-qualified table names by default. You may pass the `schemaQualified` argument to change the behavior as desired: @@ -172,10 +172,10 @@ The `Schema::getTableListing()` method now returns schema-qualified table names $tables = Schema::getTableListing(); // ['main.migrations', 'main.users', 'blog.posts'] -$table = Schema::getTableListing(schema: 'main'); +$tables = Schema::getTableListing(schema: 'main'); // ['main.migrations', 'main.users'] -$table = Schema::getTableListing(schema: 'main', schemaQualified: false); +$tables = Schema::getTableListing(schema: 'main', schemaQualified: false); // ['migrations', 'users'] ``` From c1286bad99774bb478cd9ed66e8eaebdbd6ab606 Mon Sep 17 00:00:00 2001 From: Hafez Divandari Date: Fri, 23 May 2025 18:50:50 +0330 Subject: [PATCH 2/3] formatting --- passport.md | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/passport.md b/passport.md index cb0c348418..49e2241c07 100644 --- a/passport.md +++ b/passport.md @@ -255,6 +255,7 @@ To get started, we need to instruct Passport how to return our "authorization" v All the authorization view's rendering logic may be customized using the appropriate methods available via the `Laravel\Passport\Passport` class. Typically, you should call this method from the `boot` method of your application's `App\Providers\AppServiceProvider` class: ```php +use Inertia\Inertia; use Laravel\Passport\Passport; /** @@ -638,6 +639,7 @@ To get started, we need to instruct Passport how to return our "user code" and " All the authorization view's rendering logic may be customized using the appropriate methods available via the `Laravel\Passport\Passport` class. Typically, you should call this method from the `boot` method of your application's `App\Providers\AppServiceProvider` class. ```php +use Inertia\Inertia; use Laravel\Passport\Passport; /** @@ -650,15 +652,18 @@ public function boot(): void Passport::deviceAuthorizationView('auth.oauth.device.authorize'); // By providing a closure... - Passport::deviceUserCodeView(fn ($parameters) => Inertia::render('Auth/OAuth/Device/UserCode')); - - Passport::deviceAuthorizationView(fn ($parameters) => Inertia::render('Auth/OAuth/Device/Authorize', [ - 'request' => $parameters['request'], - 'authToken' => $parameters['authToken'], - 'client' => $parameters['client'], - 'user' => $parameters['user'], - 'scopes' => $parameters['scopes'], - ])); + Passport::deviceUserCodeView( + fn ($parameters) => Inertia::render('Auth/OAuth/Device/UserCode') + ); + Passport::deviceAuthorizationView( + fn ($parameters) => Inertia::render('Auth/OAuth/Device/Authorize', [ + 'request' => $parameters['request'], + 'authToken' => $parameters['authToken'], + 'client' => $parameters['client'], + 'user' => $parameters['user'], + 'scopes' => $parameters['scopes'], + ]) + ); // ... } @@ -738,7 +743,7 @@ do { $response = Http::asForm()->post('https://passport-app.test/oauth/token', [ 'grant_type' => 'urn:ietf:params:oauth:grant-type:device_code', 'client_id' => 'your-client-id', - 'client_secret' => 'your-client-secret', // required for confidential clients only + 'client_secret' => 'your-client-secret', // Required for confidential clients only... 'device_code' => 'the-device-code', ]); @@ -792,7 +797,7 @@ use Illuminate\Support\Facades\Http; $response = Http::asForm()->post('https://passport-app.test/oauth/token', [ 'grant_type' => 'password', 'client_id' => 'your-client-id', - 'client_secret' => 'your-client-secret', // required for confidential clients only + 'client_secret' => 'your-client-secret', // Required for confidential clients only... 'username' => 'taylor@laravel.com', 'password' => 'my-password', 'scope' => 'user:read orders:create', @@ -815,7 +820,7 @@ use Illuminate\Support\Facades\Http; $response = Http::asForm()->post('https://passport-app.test/oauth/token', [ 'grant_type' => 'password', 'client_id' => 'your-client-id', - 'client_secret' => 'your-client-secret', // required for confidential clients only + 'client_secret' => 'your-client-secret', // Required for confidential clients only... 'username' => 'taylor@laravel.com', 'password' => 'my-password', 'scope' => '*', @@ -839,9 +844,10 @@ namespace App\Models; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; +use Laravel\Passport\Contracts\OAuthenticatable; use Laravel\Passport\HasApiTokens; -class User extends Authenticatable +class User extends Authenticatable implements OAuthenticatable { use HasApiTokens, Notifiable; @@ -868,9 +874,10 @@ namespace App\Models; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Illuminate\Support\Facades\Hash; +use Laravel\Passport\Contracts\OAuthenticatable; use Laravel\Passport\HasApiTokens; -class User extends Authenticatable +class User extends Authenticatable implements OAuthenticatable { use HasApiTokens, Notifiable; @@ -1127,9 +1134,9 @@ If a client does not request any specific scopes, you may configure your Passpor use Laravel\Passport\Passport; Passport::tokensCan([ - 'user:read' => 'Retrieve the user info', - 'orders:create' => 'Place orders', - 'orders:read:status' => 'Check order status', + 'user:read' => 'Retrieve the user info', + 'orders:create' => 'Place orders', + 'orders:read:status' => 'Check order status', ]); Passport::defaultScopes([ @@ -1305,6 +1312,7 @@ Passport raises events when issuing access tokens and refresh tokens. You may [l | Event Name | | --- | | `Laravel\Passport\Events\AccessTokenCreated` | +| `Laravel\Passport\Events\AccessTokenRevoked` | | `Laravel\Passport\Events\RefreshTokenCreated` | From 9775ddd570a309cb8a3f6d0cde6a1c8361b9d595 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 26 May 2025 10:25:22 -0700 Subject: [PATCH 3/3] Update passport.md --- passport.md | 1 + 1 file changed, 1 insertion(+) diff --git a/passport.md b/passport.md index 49e2241c07..94ab791d21 100644 --- a/passport.md +++ b/passport.md @@ -655,6 +655,7 @@ public function boot(): void Passport::deviceUserCodeView( fn ($parameters) => Inertia::render('Auth/OAuth/Device/UserCode') ); + Passport::deviceAuthorizationView( fn ($parameters) => Inertia::render('Auth/OAuth/Device/Authorize', [ 'request' => $parameters['request'],