1. Go to this page and download the library: Download victor-falcon/laravel-task 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/ */
victor-falcon / laravel-task example snippets
declare(strict_types=1);
namespace App\Tasks\Shop;
use VictorFalcon\LaravelTask\Task;
use VictorFalcon\LaravelTask\Taskable;
final class CreateUserShop implements Task
{
use Taskable;
private User $user;
public function __construct(User $user)
{
$this->user = $user;
}
public function handle(ShopCreator $creator): Shop
{
// Create your shop
}
}
$shop = CreateUserShop::trigger($user);
final class CreateUser implements Task
{
public function rules(): array
{
return [
'name' => 'urn User::create($this->data);
}
}