laravel-actions
laravel-actions copied to clipboard
⚡️ Laravel components that take care of one specific task
How to use it with Laravel Pipeline ? Should we use it with method overload ? because Pipeline actions is `handle($mixed, $closure)`, but we also has handle function in laravel...
Trying to mock or partialMock any Action Object when the WithAttributes Trait attached throws Received Mockery_#_App_Actions_Action::set(), but no expectations were specified
### PHPUnit Testing ```php use DatabaseTransactions; # Record is Removed from Database After this Test public function test_asObject_CreateUserAction() { CreateUserAction::run([ 'first_name' => 'Test', 'last_name' => 'Test' ]); $this->assertDatabaseCount('users', 1); }...
Hi, I got an action which dispatches jobs (which are actions too, hurray). Looks like that: ``` $documents->each(fn($doc) => GenerateDocumentFiles::dispatch($doc)); ``` and is tested nicely with that ``` ProcessMissionDeliverable::assertPushedOn('default', 2);...
Can we use [Laravel Event Discovery](https://laravel.com/docs/10.x/events#event-discovery) when using `AsListener` trait on the `Action` class?
In my application, I have to manually get the route binding-resolved model from the `ActionRequest` in the `authorize` method. ```php public function authorize(ActionRequest $request): void { Gate::authorize('view', [$request->route('attempt')]); } public...
It feels a bit archaic to have to define routes for the actions, so rather than having to do that explicitly for each route, there is now a generic route...
I was working on testing my actions and used the `shouldRun` method and it wasn't working. Turns out I need to add `->once()` in order for a test to actually...
It doesn't throw errors in PHPStan if args type, numbers etc. mismatches... ```php namespace App\Authentication\Actions; use Lorisleiva\Actions\Concerns\AsAction; class UpdateUserPassword { use AsAction; public function handle(User $user, string $newPassword) { $user->password...
In default laravel job, you can access use `$this->release(60)` method to release the job back into queue. How to do this in this package?