1. Go to this page and download the library: Download mattkingshott/waterfall 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/ */
mattkingshott / waterfall example snippets
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class User extends Model
{
use SoftDeletes;
}
namespace App\Jobs;
use App\Models\User;
use Waterfall\Jobs\Job;
class DeleteUserJob extends Job
{
public static string $type = User::class;
}
use Waterfall\Tasks\Task;
protected function tasks() : array
{
return [
Task::create()
->model(Post::class)
];
}
use Waterfall\Tasks\Task;
protected function tasks() : array
{
return [
Task::create()
->table('posts')
];
}
protected function tasks() : array
{
return [
Task::create()
->model(Post::class)
->batch(10) // retrieve up to 10 records at a time
->rest(15) // delay follow-up jobs for the task by 15 seconds
];
}