PHP code example of jildertmiedema / laravel-tactician

1. Go to this page and download the library: Download jildertmiedema/laravel-tactician library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jildertmiedema / laravel-tactician example snippets



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('/');
    }
}

$this->app['tactician.middleware']->prepend('your.middleware');

$this->app->bind('your.middleware', function () {
    return new MiddleWare
});

$this->bind('tactician.handler.locator', function () {
    return new YourLocator();
});

php artisan vendor:publish
config/tactician.php