mirror of
https://github.com/stancl/tenancy-docs.git
synced 2025-12-12 10:14:03 +00:00
Merge branch 'master' into sail-docs
This commit is contained in:
commit
f1bae7e14e
9 changed files with 55 additions and 12 deletions
|
|
@ -29,19 +29,35 @@ To use Passport inside the tenant part of your application, you may do the follo
|
|||
];
|
||||
```
|
||||
|
||||
3. Prevent Passport migrations from running in the central application by adding `Passport::ignoreMigrations()` to the `register` method in your `AppServiceProvider`.
|
||||
3. Prevent Passport migrations from running in the central application by adding `Passport::ignoreMigrations()` to the `register` method in your `AppServiceProvider`.
|
||||
|
||||
4. Apply Passport migrations by running `php artisan tenants:migrate`.
|
||||
|
||||
5. Register the Passport routes in your `AuthServiceProvider` by adding the following code to the provider's `boot` method.
|
||||
```php
|
||||
4. If you're using Passport 10.x, register the Passport routes in your `AuthServiceProvider` by adding the following code to the provider's `boot` method:
|
||||
```php
|
||||
Passport::routes(null, ['middleware' => [
|
||||
InitializeTenancyByDomain::class, // Or other identification middleware of your choice
|
||||
PreventAccessFromCentralDomains::class,
|
||||
]]);
|
||||
```
|
||||
|
||||
|
||||
5. If you're using Passport 11.x, disable the automatic Passport route registering and register the routes manually by adding the following code to the `register` method in your `AppServiceProvider`:
|
||||
|
||||
```php
|
||||
Passport::$registersRoutes = false;
|
||||
|
||||
Route::group([
|
||||
'as' => 'passport.',
|
||||
'middleware' => [InitializeTenancyByDomain::class], // Use tenancy initialization middleware of your choice
|
||||
'prefix' => config('passport.path', 'oauth'),
|
||||
'namespace' => 'Laravel\Passport\Http\Controllers',
|
||||
], function () {
|
||||
$this->loadRoutesFrom(__DIR__ . "/../../vendor/laravel/passport/src/../routes/web.php");
|
||||
});
|
||||
```
|
||||
|
||||
6. Set up [the encryption keys](#passport-encryption-keys).
|
||||
6. Apply Passport migrations by running `php artisan tenants:migrate`.
|
||||
|
||||
7. Set up [the encryption keys](#passport-encryption-keys).
|
||||
|
||||
## **Using Passport in both the tenant and the central application** {#using-passport-in-both-the-tenant-and-the-central-application}
|
||||
To use Passport in both the tenant and the central application, follow [the steps for using Passport in the tenant appliction](#using-passport-in-the-tenant-application-only) with the following adjustments:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue