Extensibility
Custom dispatcher
Bind your own implementation of BradieTilley\Actions\Contracts\Dispatcher:
$this->app->singleton(
\BradieTilley\Actions\Contracts\Dispatcher::class,
CustomDispatcher::class,
);
Overriding construction
Dispatchable::newAction() resolves the class (honouring Action::replace())
and constructs with new. Override it on a base action class to use the
container or a factory:
protected static function newAction(mixed ...$arguments): static
{
return app(static::class, /* ... */);
}
Action logging helpers
BradieTilley\Actions\Concerns\ActionLogs is an optional PSR-style logging
trait (info(), error(), useLogChannel(), etc.). It is not included on
the base Action — use it where useful:
use BradieTilley\Actions\Action;
use BradieTilley\Actions\Concerns\ActionLogs;
class ImportCsv extends Action
{
use ActionLogs;
public function handle(): void
{
$this->info('Import started');
}
}
Artisan generator
php artisan make:action SendInvoice
Override the stub by placing stubs/action.stub in your application root.
Global middleware
See Middleware for
prependGlobalMiddleware / appendGlobalMiddleware.
Continue to Compatibility.