jildertmiedema/laravel-tactician
最新稳定版本:v0.7.0
Composer 安装命令:
composer require jildertmiedema/laravel-tactician
包简介
Tactician for laravel 8+
README 文档
README
Tactician command bus for laravel 12+
Install
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
Usage
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('/'); } }
Extending
Middleware
In your own ServiceProvider:
$this->app['tactician.middleware']->prepend('your.middleware'); $this->app->bind('your.middleware', function () { return new MiddleWare });
Locator
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(); });
统计信息
- 总下载量: 4.93k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-06-17