code-rhapsodie/ezdataflow-bundle
Install the package via Composer:
composer require vendor/package-name
Publish migrations if needed (check vendor/package-name/database/migrations/ for new tables/columns):
php artisan vendor:package-name publish --provider="Vendor\PackageName\PackageServiceProvider" --tag="migrations"
Run migrations to enable error count tracking:
php artisan migrate
First use case: Query job tables for error statistics:
// Example: Get jobs with error counts
$jobsWithErrors = \Vendor\PackageName\Models\Job::withCount('errors')->get();
Automatic Error Logging
The package now auto-populates error_count columns in job tables. Integrate with existing job failure handlers:
// In your job's handle() or failed() method
public function failed(\Throwable $exception)
{
$this->incrementErrorCount(); // Hypothetical helper method
}
Query Optimization
Use withCount('errors') for efficient error-aware queries:
// Filter jobs with errors
$criticalJobs = \Vendor\PackageName\Models\Job::whereHas('errors')->orderBy('error_count', 'desc')->get();
Dashboard Widgets Add error count badges to admin panels:
// Example: Total errors across all jobs
$totalErrors = \Vendor\PackageName\Models\Job::sum('error_count');
Existing Databases: If upgrading from <v3.4.0, run:
php artisan vendor:package-name:upgrade
to add error_count columns without data loss.
Schema Conflicts: If custom job tables exist, manually add:
Schema::table('custom_jobs', function (Blueprint $table) {
$table->integer('error_count')->default(0);
});
error_count is indexed for large tables:
Schema::table('jobs', function (Blueprint $table) {
$table->index('error_count');
});
errors() relationship in your job model:
public function errors()
{
return $this->hasMany(\App\Models\CustomJobError::class);
}
job.error.incremented events to notify external systems:
Event::listen('job.error.incremented', function ($job) {
// Send Slack/email alerts
});
How can I help you explore Laravel packages today?