mirror of
https://github.com/stancl/tenancy-docs.git
synced 2025-12-12 10:14:03 +00:00
Apply suggestions from code review
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
This commit is contained in:
parent
30ce005ffb
commit
c518e7abed
1 changed files with 3 additions and 3 deletions
|
|
@ -59,12 +59,12 @@ After the tenant is created, an event will be fired. This will result in things
|
||||||
|
|
||||||
## Custom columns {#custom-columns}
|
## Custom columns {#custom-columns}
|
||||||
|
|
||||||
Attributes of the tenant model which don't have their column will be stored in the `data` JSON column. You can set these attributes as you'd normally set model attributes:
|
Attributes of the tenant model which don't have their own column will be stored in the `data` JSON column. You can set these attributes like you'd set normal model attributes:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
$tenant->update([
|
$tenant->update([
|
||||||
'attributeThatHasNoColumn' => 'value', // stored in the `data` JSON column
|
'attributeThatHasNoColumn' => 'value', // stored in the `data` JSON column
|
||||||
'plan' => 'free' // stored in the `plan` column (see below)
|
'plan' => 'free' // stored in the dedicated `plan` column (see below)
|
||||||
]);
|
]);
|
||||||
```
|
```
|
||||||
or
|
or
|
||||||
|
|
@ -74,7 +74,7 @@ $tenant->plan = 'free'; // stored in the `plan` column (see below)
|
||||||
$tenant->save();
|
$tenant->save();
|
||||||
```
|
```
|
||||||
|
|
||||||
You may define the custom columns that **won't** be stored in the `data` JSON column by overriding the `getCustomColumns()` method on your `Tenant` model:
|
You may define the custom columns (that **won't** be stored in the `data` JSON column) by overriding the `getCustomColumns()` method on your `Tenant` model:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
public static function getCustomColumns(): array
|
public static function getCustomColumns(): array
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue