dev-master
9999999-devSimple bundle to store queued jobs statuses and history.
MIT
The Requires
- php >=5.4.0
- illuminate/support 4.2.*
laravel eloquent queue job worker
Simple bundle to store queued jobs statuses and history.
Eloquent based Jobs for Laravel, (*1)
It's under development, not recommended for production use!, (*2)
Tipically it creates in the controller., (*3)
$job = new JobModel; $job->name = 'Export customers'; $job->save(); $job->run('MyJob');
The string parameter of the run method is the class name of the Worker in the next step., (*4)
Feel free to extend this model, just read the extended model section in the worker., (*5)
Extend Job to make your own working code, (*6)
use Hlacos\Joboquent\Job; class MyJob extends Job { // Callbacks public function beforeStart() {} public function beforeEnd() {} // The working code public function work() {} }
Only override the $jobModelClass public attribute name to the Extended class name., (*7)
Tipically used in the work method in a cycle., (*8)
$this->jobModel->setPercent($percent);
You can set polimorphic relation to the JobModel., (*9)
public function jobs() { return $this->morphMany('Hlacos\Joboquent\JobModel', 'jobable'); }
public function job() { return $this->morphOne('Hlacos\Joboquent\JobModel', 'jobable'); }
Don't forget to save related model to the jobModel before it runs., (*10)
Simple bundle to store queued jobs statuses and history.
MIT
laravel eloquent queue job worker