PHP code example of mohammedmanssour / failed-jobs-model

1. Go to this page and download the library: Download mohammedmanssour/failed-jobs-model 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/ */

    

mohammedmanssour / failed-jobs-model example snippets


use MohammedManssour\FailedJobsModel\FailedJob;

$job = FailedJob::findByJobId($uuid);   // single job by uuid, or null

$job->display_name;   // e.g. "App\Jobs\SendEmail" (indexed)
$job->payload;        // decoded payload object
$job->command;        // the unserialized job command instance
$job->exception;      // exception text
$job->failed_at;      // Carbon instance

// Jobs for a given class name (uses the indexed display_name column)
FailedJob::whereDisplayName('App\Jobs\SendEmail')->get();
FailedJob::findByDisplayName('App\Jobs\SendEmail'); // shortcut, latest first

// Search the exception text (case-insensitive)
FailedJob::whereExceptionContains('Connection timed out')->get();

// Drop the default failed_at ordering (e.g. for aggregations)
FailedJob::withoutLatestFailed()->get();

'pruning' => [
    'enabled' => env('FAILED_JOBS_PRUNE_ENABLED', true),
    'hours' => (int) env('FAILED_JOBS_PRUNE_HOURS', 168),       // delete jobs older than 7 days
    'at' => env('FAILED_JOBS_PRUNE_AT', '01:00'),                // daily run time
    'environments' => [...],                                     // limit to these envs (empty = all)
],
bash
php artisan migrate
bash
php artisan vendor:publish --tag="failed-jobs-model-config"
php artisan vendor:publish --tag="failed-jobs-model-migrations"