Skip to content

Commit

Permalink
Merge pull request #501 from jacobmllr95/chore-correct-typos
Browse files Browse the repository at this point in the history
Correct Typos
  • Loading branch information
masterix21 authored Dec 5, 2023
2 parents 6f1afb3 + 7e9fba9 commit 5253dce
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 32 deletions.
6 changes: 3 additions & 3 deletions config/multitenancy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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,

Expand All @@ -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'
Expand Down
16 changes: 9 additions & 7 deletions docs/advanced-usage/executing-code-for-tenants-and-landlords.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
});
```
Expand All @@ -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:

Expand All @@ -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:

Expand All @@ -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'));
});
```

Expand Down Expand Up @@ -112,7 +114,7 @@ protected function setUp(): void
Event::listen(MadeTenantCurrentEvent::class, function () {
$this->beginDatabaseTransaction();
});

Tenant::first()->makeCurrent();
}
```
12 changes: 5 additions & 7 deletions docs/advanced-usage/making-artisan-commands-tenant-aware.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
```
Expand Down
1 change: 0 additions & 1 deletion docs/advanced-usage/using-tenant-specific-facades.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 3 additions & 1 deletion docs/basic-usage/making-queues-tenant-aware.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class TestJob implements ShouldQueue, TenantAware
```

or, using the config `multitenancy.php`:

```php
'tenant_aware_jobs' => [
TestJob::class,
Expand All @@ -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;
Expand All @@ -49,6 +50,7 @@ class TestJob implements ShouldQueue, NotTenantAware
```

or, using the config `multitenancy.php`:

```php
'not_tenant_aware_jobs' => [
TestJob::class,
Expand Down
1 change: 0 additions & 1 deletion docs/basic-usage/working-with-the-current-tenant.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions docs/installation/base-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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,

Expand All @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion docs/installation/using-a-single-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions docs/installation/using-multiple-databases.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -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+**.
2 changes: 1 addition & 1 deletion docs/support-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ use Spatie\Multitenancy\Tasks\SwitchTenantTask;
class SwitchTenantDatabaseTask implements SwitchTenantTask
{
public function __construct(string $name, string $anotherName)
{
{
// do something
}
}
Expand All @@ -98,7 +98,7 @@ use Spatie\Multitenancy\Tasks\SwitchTenantTask;
class SwitchTenantDatabaseTask implements SwitchTenantTask
{
public function __construct(string $name, string $anotherName, MyDepencency $myDependency)
{
{
// do something
}
}
Expand Down
4 changes: 2 additions & 2 deletions docs/using-tasks-to-prepare-the-environment/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 5253dce

Please sign in to comment.