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
The usage is nearly identical to calling the methods directly on the Action as mentioned in the section above. The benefit here is that you can easily test actions using `Action::shouldReceive('act')`, `Action::shouldReceive('actWhen')` or `Action::shouldReceive('actUnless')`.
@@ -118,23 +118,23 @@ The usage is nearly identical to calling the methods directly on the Action as m
118
118
The package also has a few handy helpers to get Chuck in action. Here's the syntax:
119
119
120
120
```php
121
-
act(new ChuckNorris($data));
122
-
act_when($isChuckNorrisMighty, new ChuckNorris($data));
123
-
act_unless($isChuckNorrisPuny, new ChuckNorris($data));
@@ -171,6 +171,22 @@ Another option for handling failures is to tell the Action to throw its own exce
171
171
public $exception = SeagalFailedException::class;
172
172
```
173
173
174
+
## Auto-Discovery and Configuration
175
+
176
+
Out of the box, actions are automatically discovered and bound to Laravel's container, which allows for easier testing of your actions. If you need to add a custom path if you are placing your actions somewhere other than `app/Actions`, make sure to publish the configs.
177
+
178
+
```bash
179
+
php artisan vendor:publish --tag laravel-actions
180
+
```
181
+
182
+
If you want to disable auto-discovery, publish the config and return an empty array from the `paths` key.
183
+
184
+
```php
185
+
return [
186
+
'paths' => [],
187
+
];
188
+
```
189
+
174
190
## Testing
175
191
176
192
Have no fear. Testing all of this is very straightforward. There are two approaches to testing built in.
0 commit comments