You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/hyn/5.2/tinker.md
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,9 +5,9 @@ icon: fal fa-screwdriver
5
5
6
6
# Tenant Aware Tinker Command
7
7
8
-
This tinker documentation will allow you to extend the tinker command and make it tenant aware.
8
+
This article describes how to enable tenant awareness for the native Laravel tinker command.
9
9
10
-
First create a trait named `MutatesTinkerCommand.php` with the following content:
10
+
First, create a trait named `MutatesTinkerCommand` with the following content:
11
11
12
12
```php
13
13
<?php
@@ -73,10 +73,9 @@ trait MutatesTinkerCommand
73
73
}
74
74
}
75
75
```
76
+
You can only tinker on one database at a time, therefore, the `website_id` needs to be a required option. Utilizing the `AddWebsiteFilterOnCommand` trait available in the Tenancy package would not work in this instance; it is tailored to run processes on multiple websites and makes the `website_id` parameter optional.
76
77
77
-
We didn’t opted on using the `AddWebsiteFilterOnCommand.php` trait available in the Tenancy package since you can only tinker on one database at a time and the `website_id` needs to be a required option. The `AddWebsiteFilterCommand` is tailored for multiple websites and that the `website_id` is optional.
78
-
79
-
Second, create a new console command `TinkerCommand.php` that uses the trait above.
78
+
Second, create a new console command `TinkerCommand` that uses the trait above.
80
79
81
80
```php
82
81
<?php
@@ -117,7 +116,7 @@ class Kernel extends ConsoleKernel
117
116
}
118
117
```
119
118
120
-
Now we have created a new `tenancy:tinker` artisan command. The `tenancy:tinker` requires the `--website_id=` option as a parameter. So, in order to run tinker on, let’s say, `website_id` of 1 you’ll need to run:
119
+
Now we have created a new `tenancy:tinker` artisan command. The `tenancy:tinker` requires the `--website_id=` option as a parameter. So, in order to run tinker on, let’s say with a `website_id` of 1, you’ll need to run:
0 commit comments