Package Data | |
---|---|
Maintainer Username: | jildertmiedema |
Maintainer Contact: | git@jildertmiedema.nl (Jildert Miedema) |
Package Create Date: | 2015-06-17 |
Package Last Update: | 2024-01-22 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-22 03:12:29 |
Package Statistics | |
---|---|
Total Downloads: | 4,848 |
Monthly Downloads: | 4 |
Daily Downloads: | 0 |
Total Stars: | 8 |
Total Watchers: | 1 |
Total Forks: | 5 |
Total Open Issues: | 1 |
Tactician command bus for laravel 5+
composer require jildertmiedema/laravel-tactician
Add JildertMiedema\LaravelTactician\TacticianServiceProvider
to your app.php
Run this in the command line:
php artisan vendor:publish
Edit config/tactician.php
and set your namespaces
In your controllers or console commands you can use the trait JildertMiedema\LaravelTactician\DispatchesCommands
.
use YourApp\Commmands\DoSomethingCommand;
use Illuminate\Routing\Controller as BaseController;
use JildertMiedema\LaravelTactician\DispatchesCommands;
class Controller extends BaseController
{
use DispatchesCommands;
public function store(Request $request)
{
$command = new DoSomethingCommand($request->get('id'), $request->get('value'));
$this->dispatch($command);
return redirect('/');
}
}
In your own ServiceProvider:
$this->app['tactician.middleware']->prepend('your.middleware');
$this->app->bind('your.middleware', function () {
return new MiddleWare
});
The default locator is set in the container by tactician.handler.locator
, of course you can change it.
In your own ServiceProvider:
$this->bind('tactician.handler.locator', function () {
return new YourLocator();
});