From 7e9fba90a68c6f93780b6edd8ef791c484d5656d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20M=C3=BCller?= Date: Sun, 3 Dec 2023 10:37:39 +0100 Subject: [PATCH] chore: correct typos --- config/multitenancy.php | 6 +++--- .../executing-code-for-tenants-and-landlords.md | 16 +++++++++------- .../making-artisan-commands-tenant-aware.md | 12 +++++------- .../using-tenant-specific-facades.md | 1 - docs/basic-usage/making-queues-tenant-aware.md | 4 +++- .../working-with-the-current-tenant.md | 1 - docs/installation/base-installation.md | 6 +++--- docs/installation/using-a-single-database.md | 2 +- docs/installation/using-multiple-databases.md | 3 +-- docs/requirements.md | 2 +- docs/support-us.md | 2 +- .../creating-your-own-task.md | 4 ++-- .../overview.md | 4 ++-- .../switching-route-cache-paths.md | 1 + 14 files changed, 32 insertions(+), 32 deletions(-) diff --git a/config/multitenancy.php b/config/multitenancy.php index 4fb1f10..e022856 100644 --- a/config/multitenancy.php +++ b/config/multitenancy.php @@ -22,7 +22,7 @@ 'tenant_finder' => null, /* - * These fields are used by tenant:artisan command to match one or more tenant + * These fields are used by tenant:artisan command to match one or more tenant. */ 'tenant_artisan_search_fields' => [ 'id', @@ -61,7 +61,7 @@ 'tenant_database_connection_name' => null, /* - * The connection name to reach the landlord database + * The connection name to reach the landlord database. */ 'landlord_database_connection_name' => null, @@ -88,7 +88,7 @@ ], /* - * You can customize the way in which the package resolves the queuable to a job. + * You can customize the way in which the package resolves the queueable to a job. * * For example, using the package laravel-actions (by Loris Leiva), you can * resolve JobDecorator to getAction() like so: JobDecorator::class => 'getAction' diff --git a/docs/advanced-usage/executing-code-for-tenants-and-landlords.md b/docs/advanced-usage/executing-code-for-tenants-and-landlords.md index 66b0bc3..4c3e3ab 100644 --- a/docs/advanced-usage/executing-code-for-tenants-and-landlords.md +++ b/docs/advanced-usage/executing-code-for-tenants-and-landlords.md @@ -14,7 +14,7 @@ Here is an example where we flush the cache for a tenant using our landlord API: ```php Route::delete('/api/{tenant}/flush-cache', function (Tenant $tenant) { $result = $tenant->execute(fn (Tenant $tenant) => cache()->flush()); - + return json_encode(["success" => $result]); }); ``` @@ -25,12 +25,14 @@ Here's another example, where a job is dispatched from a landlord API route: ```php Route::post('/api/{tenant}/reminder', function (Tenant $tenant) { - return json_encode([ + return json_encode([ 'data' => $tenant->execute(fn () => dispatch(ExpirationReminder())), ]); }); ``` + ### Executing a delayed callback in the correct Tenant context + If you need to define a callback that will be executed in the correct Tenant context every time it is called, you can use the Tenant's `callback` method. A notable example for this is the use in the Laravel scheduler where you can loop through all the tenants and schedule callbacks to be executed at the given time: @@ -45,7 +47,7 @@ protected function schedule(Schedule $schedule) ## Executing landlord code in tenant request -To execute landlord code, from inside a tenant request, you can use the method `execute` on `Spatie\Multitenancy\Landlord`. +To execute landlord code, from inside a tenant request, you can use the method `execute` on `Spatie\Multitenancy\Landlord`. Here is an example where we will first clear the tenant cache, and next, the landlord cache: @@ -56,10 +58,10 @@ use Spatie\Multitenancy\Landlord; Tenant::first()->execute(function (Tenant $tenant) { // it will clear the tenant cache - Artisan::call('cache:clear'); - + Artisan::call('cache:clear'); + // it will clear the landlord cache - Landlord::execute(fn () => Artisan::call('cache:clear')); + Landlord::execute(fn () => Artisan::call('cache:clear')); }); ``` @@ -112,7 +114,7 @@ protected function setUp(): void Event::listen(MadeTenantCurrentEvent::class, function () { $this->beginDatabaseTransaction(); }); - + Tenant::first()->makeCurrent(); } ``` diff --git a/docs/advanced-usage/making-artisan-commands-tenant-aware.md b/docs/advanced-usage/making-artisan-commands-tenant-aware.md index f93a4b2..a8659c6 100644 --- a/docs/advanced-usage/making-artisan-commands-tenant-aware.md +++ b/docs/advanced-usage/making-artisan-commands-tenant-aware.md @@ -5,13 +5,13 @@ weight: 3 Commands can be made tenant aware by applying the `TenantAware` trait. When using the trait it is required to append `{--tenant=*}` or `{--tenant=}` to the command signature. -Caution: If you append `{--tenant=*}`, then if no `tenant` option is provided when executing the command, the command will execute for *all* tenants. - +Caution: If you append `{--tenant=*}`, then if no `tenant` option is provided when executing the command, the command will execute for _all_ tenants. + ```php use Illuminate\Console\Command; use Spatie\Multitenancy\Commands\Concerns\TenantAware; -class YourFavouriteCommand extends Command +class YourFavoriteCommand extends Command { use TenantAware; @@ -24,18 +24,16 @@ class YourFavouriteCommand extends Command } ``` -When executing the command, the `handle` method will be called for each tenant. +When executing the command, the `handle` method will be called for each tenant. ```bash -php artisan your-favorite-command +php artisan your-favorite-command ``` Using the example above, the name of each tenant will be written to the output of the command. - You can also execute the command for a specific tenant: - ```bash php artisan your-favorite-command --tenant=1 ``` diff --git a/docs/advanced-usage/using-tenant-specific-facades.md b/docs/advanced-usage/using-tenant-specific-facades.md index 349339a..3d437e8 100644 --- a/docs/advanced-usage/using-tenant-specific-facades.md +++ b/docs/advanced-usage/using-tenant-specific-facades.md @@ -7,7 +7,6 @@ Facades behave like singletons. They only resolve once, and each use of the faca If you only have a couple of tenant specific facade, we recommend only clearing them when switching a tenant. Here's a task that you could use for this. - ```php namespace App\Tenancy\SwitchTasks; diff --git a/docs/basic-usage/making-queues-tenant-aware.md b/docs/basic-usage/making-queues-tenant-aware.md index 84a80db..35e3e3d 100644 --- a/docs/basic-usage/making-queues-tenant-aware.md +++ b/docs/basic-usage/making-queues-tenant-aware.md @@ -25,6 +25,7 @@ class TestJob implements ShouldQueue, TenantAware ``` or, using the config `multitenancy.php`: + ```php 'tenant_aware_jobs' => [ TestJob::class, @@ -34,7 +35,7 @@ or, using the config `multitenancy.php`: ## Making specific jobs not tenant aware Jobs that never should be tenant aware should implement the empty marker interface `Spatie\Multitenancy\Jobs\NotTenantAware` or should be added to the config `not_tenant_aware_jobs`. - + ```php use Illuminate\Contracts\Queue\ShouldQueue; use Spatie\Multitenancy\Jobs\NotTenantAware; @@ -49,6 +50,7 @@ class TestJob implements ShouldQueue, NotTenantAware ``` or, using the config `multitenancy.php`: + ```php 'not_tenant_aware_jobs' => [ TestJob::class, diff --git a/docs/basic-usage/working-with-the-current-tenant.md b/docs/basic-usage/working-with-the-current-tenant.md index b90485c..baed5a5 100644 --- a/docs/basic-usage/working-with-the-current-tenant.md +++ b/docs/basic-usage/working-with-the-current-tenant.md @@ -37,7 +37,6 @@ $tenant->makeCurrent(); When a tenant is made the current one, the package will run the `makeCurrent` method of [all tasks configured](/docs/laravel-multitenancy/v3/using-tasks-to-prepare-the-environment/overview/) in the `switch_tenant_tasks` key of the `multitenancy` config file. - ### Forgetting the current tenant You can forget the current tenant: diff --git a/docs/installation/base-installation.md b/docs/installation/base-installation.md index 7547f58..51a7d95 100644 --- a/docs/installation/base-installation.md +++ b/docs/installation/base-installation.md @@ -44,7 +44,7 @@ return [ 'tenant_finder' => null, /* - * These fields are used by tenant:artisan command to match one or more tenant + * These fields are used by tenant:artisan command to match one or more tenant. */ 'tenant_artisan_search_fields' => [ 'id', @@ -83,7 +83,7 @@ return [ 'tenant_database_connection_name' => null, /* - * The connection name to reach the landlord database + * The connection name to reach the landlord database. */ 'landlord_database_connection_name' => null, @@ -110,7 +110,7 @@ return [ ], /* - * You can customize the way in which the package resolves the queuable to a job. + * You can customize the way in which the package resolves the queueable to a job. * * For example, using the package laravel-actions (by Loris Leiva), you can * resolve JobDecorator to getAction() like so: JobDecorator::class => 'getAction' diff --git a/docs/installation/using-a-single-database.md b/docs/installation/using-a-single-database.md index 4a58f57..aeee4f7 100644 --- a/docs/installation/using-a-single-database.md +++ b/docs/installation/using-a-single-database.md @@ -5,7 +5,7 @@ weight: 2 Before using the following instructions, make sure you have performed [the base installation steps](/docs/laravel-multitenancy/v3/installation/base-installation) first. - Only use the instructions on this page if you want to use one database. +Only use the instructions on this page if you want to use one database. ### Migrating the database diff --git a/docs/installation/using-multiple-databases.md b/docs/installation/using-multiple-databases.md index 3778836..5fe3b1c 100644 --- a/docs/installation/using-multiple-databases.md +++ b/docs/installation/using-multiple-databases.md @@ -40,7 +40,6 @@ In the example below, the `mysql` driver is used, but you can use any driver you ], ``` - ### Migrating the landlord database With the database connection set up, we can migrate the landlord database. @@ -101,7 +100,7 @@ php artisan tenants:artisan "migrate --database=tenant" If you want to have dedicated directory for tenant migrations (`database/migrations/tenant`) you can simply run: ```bash -php artisan tenants:artisan "migrate --path=database/migrations/tenant --database=tenant" +php artisan tenants:artisan "migrate --path=database/migrations/tenant --database=tenant" ``` ### Seeding tenant databases diff --git a/docs/requirements.md b/docs/requirements.md index 1670db0..e28d6ac 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -3,4 +3,4 @@ title: Requirements weight: 3 --- -This package requires **PHP 8.0+** and **Laravel 8.0+**. +This package requires **PHP 8.0+** and **Laravel 8.0+**. diff --git a/docs/support-us.md b/docs/support-us.md index 90f5c27..2a1b8ea 100644 --- a/docs/support-us.md +++ b/docs/support-us.md @@ -3,6 +3,6 @@ title: Support us weight: 2 --- -We invest a lot of resources into creating our [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us). +We invest a lot of resources into creating our [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us). We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards). diff --git a/docs/using-tasks-to-prepare-the-environment/creating-your-own-task.md b/docs/using-tasks-to-prepare-the-environment/creating-your-own-task.md index 7c3c8d4..b7193cf 100644 --- a/docs/using-tasks-to-prepare-the-environment/creating-your-own-task.md +++ b/docs/using-tasks-to-prepare-the-environment/creating-your-own-task.md @@ -82,7 +82,7 @@ use Spatie\Multitenancy\Tasks\SwitchTenantTask; class SwitchTenantDatabaseTask implements SwitchTenantTask { public function __construct(string $name, string $anotherName) - { + { // do something } } @@ -98,7 +98,7 @@ use Spatie\Multitenancy\Tasks\SwitchTenantTask; class SwitchTenantDatabaseTask implements SwitchTenantTask { public function __construct(string $name, string $anotherName, MyDepencency $myDependency) - { + { // do something } } diff --git a/docs/using-tasks-to-prepare-the-environment/overview.md b/docs/using-tasks-to-prepare-the-environment/overview.md index 32d7a97..d30e84b 100644 --- a/docs/using-tasks-to-prepare-the-environment/overview.md +++ b/docs/using-tasks-to-prepare-the-environment/overview.md @@ -11,7 +11,7 @@ You can easily [create your own tasks](/docs/laravel-multitenancy/v3/using-tasks The package ships with these tasks: -- [switch the tenant database](/docs/laravel-multitenancy/v3/using-tasks-to-prepare-the-environment/switching-databases) (required when using multiple tenant databases) -- [prefixing the cache](/docs/laravel-multitenancy/v3/using-tasks-to-prepare-the-environment/prefixing-cache) +- [switch the tenant database](/docs/laravel-multitenancy/v3/using-tasks-to-prepare-the-environment/switching-databases) (required when using multiple tenant databases) +- [prefixing the cache](/docs/laravel-multitenancy/v3/using-tasks-to-prepare-the-environment/prefixing-cache) These tasks are optional. When you need one, just add it to the `switch_tenant_tasks` key of the `multitenancy` config file. diff --git a/docs/using-tasks-to-prepare-the-environment/switching-route-cache-paths.md b/docs/using-tasks-to-prepare-the-environment/switching-route-cache-paths.md index dc2402d..d760655 100644 --- a/docs/using-tasks-to-prepare-the-environment/switching-route-cache-paths.md +++ b/docs/using-tasks-to-prepare-the-environment/switching-route-cache-paths.md @@ -32,6 +32,7 @@ In the default scenario, all tenants have different routes. The package creates It's the scenario where all tenants use the same routes. The package creates a shared route cache file for all tenants: `bootstrap/cache/routes-v7-tenants.php`. To enable the feature you should set to `true` the `shared_routes_cache` section of the `multitenancy` config file. + ```php // in config/multitenancy.php