PHP code example of rafaeltovar / laravel-job-trackable

1. Go to this page and download the library: Download rafaeltovar/laravel-job-trackable 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/ */

    

rafaeltovar / laravel-job-trackable example snippets


'providers' => [
  //...
  LaravelJobTrackable\Providers\LaravelJobTrackableServiceProvider::class,
];


namespace App\Jobs;

use LaravelJobTrackable\Jobs\TrackableJob;

class TrackedJob extends Job
{
    use TrackableJob;

    public function __construct($input1, $input2) {
        // track the job-execution
        $this->track(['input1' => $input1, 'input2' => $input2]); // inputs are optionals
    }

    public function handle()
    {
        // Do something...
        $this->setOutput(['output1' => $output1]); // optional
    }
}

$ctrl = app(\LaravelJobTrackable\TrackedJobController::class);

try {
    $track = $ctrl->get($idJobTrack);

    // Do something...
} catch (\Exception $e) { // not found
    // Do something...
}