Skip to content

Commit 8e5f1d8

Browse files
Update README.md - Remove unused methods
1 parent 78a1a3f commit 8e5f1d8

File tree

4 files changed

+87
-67
lines changed

4 files changed

+87
-67
lines changed

.github/workflows/main-tests.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
schedule:
9+
- cron: '0 0 * * *'
10+
11+
jobs:
12+
tests:
13+
runs-on: ubuntu-22.04
14+
15+
services:
16+
redis:
17+
image: redis
18+
ports:
19+
- 6379:6379
20+
options: --entrypoint redis-server
21+
22+
strategy:
23+
fail-fast: true
24+
matrix:
25+
php: [7.3, 7.4, '8.0', 8.1, 8.2, 8.3]
26+
laravel: [8, 9, 10, 11]
27+
exclude:
28+
- php: 7.3
29+
laravel: 9
30+
- php: 7.3
31+
laravel: 10
32+
- php: 7.3
33+
laravel: 11
34+
- php: 7.4
35+
laravel: 9
36+
- php: 7.4
37+
laravel: 10
38+
- php: 7.4
39+
laravel: 11
40+
- php: '8.0'
41+
laravel: 10
42+
- php: '8.0'
43+
laravel: 11
44+
- php: 8.1
45+
laravel: 11
46+
- php: 8.2
47+
laravel: 8
48+
- php: 8.3
49+
laravel: 8
50+
- php: 8.3
51+
laravel: 9
52+
53+
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}
54+
55+
steps:
56+
- name: Checkout code
57+
uses: actions/checkout@v4
58+
59+
- name: Setup PHP
60+
uses: shivammathur/setup-php@v2
61+
with:
62+
php-version: ${{ matrix.php }}
63+
extensions: dom, curl, libxml, mbstring, redis, zip
64+
ini-values: error_reporting=E_ALL
65+
tools: composer:v2
66+
coverage: none
67+
68+
- name: Install dependencies
69+
run: |
70+
composer require "illuminate/contracts=^${{ matrix.laravel }}" --dev --no-update
71+
composer update --prefer-dist --no-interaction --no-progress
72+
73+
- name: Execute tests
74+
run: vendor/bin/phpunit

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
<p align="center">
22
<a href="https://github.com/HPWebdeveloper/laravel-failed-jobs/actions"><img src="https://github.com/HPWebdeveloper/laravel-failed-jobs/workflows/tests/badge.svg" alt="Build Status"></a>
3-
<a href="https://packagist.org/packages/HPWebdeveloper/laravel-failed-jobs"><img src="https://img.shields.io/packagist/dt/HPWebdeveloper/laravel-failed-jobs" alt="Total Downloads"></a>
43
<a href="https://packagist.org/packages/HPWebdeveloper/laravel-failed-jobs"><img src="https://img.shields.io/packagist/v/HPWebdeveloper/laravel-failed-jobs" alt="Latest Stable Version"></a>
54
<a href="https://packagist.org/packages/HPWebdeveloper/laravel-failed-jobs"><img src="https://img.shields.io/packagist/l/HPWebdeveloper/laravel-failed-jobs" alt="License"></a>
65
</p>
76

87
# Laravel Failed Jobs
98

10-
If you're running an application and the queue driver isn't Redis, which Laravel Horizon supports, you might be missing out on the elegant features it offers. Laravel Horizon is known for its elegance and a wide range of implemented features. One of its standout features is its ability to present detailed information about failed job payloads and automatically load new failed jobs.
9+
## Introduction:
10+
11+
If you're running an application with a queue driver other than Redis, which is exclusively supported by [Laravel Horizon](https://github.com/laravel/horizon), you might be missing out on the elegant features that Horizon offers. Laravel Horizon is known for its elegance and a wide range of implemented features. One of its standout features is its ability to present detailed information about failed job payloads and automatically load new failed jobs.
1112

1213
In your specific application, if you've been longing for a similar Horizon-like UI to monitor failed_jobs, the Laravel-Failed-Jobs package has got you covered. This package simplifies the process of visualizing failed jobs.
1314

15+
![Screenshot 2024-02-01 at 7 55 42 PM](https://github.com/HPWebdeveloper/laravel-failed-jobs/assets/16323354/2ec7ebad-1ad9-4927-8bff-5ce4002e1a7c)
16+
1417
## Key Benefits:
1518

1619
Seamless Integration: You can seamlessly integrate the Laravel-Failed-Jobs package into your project, even if you are already using Laravel Horizon. There's no conflict between the two. While Horizon primarily reads and writes data to Redis, Laravel-Failed-Jobs retrieves data from the failed_jobs table.
@@ -32,12 +35,17 @@ After installing Laravel-Failed-Jobs, publish its assets using the failedjobs:in
3235
```bash
3336
php artisan failedjobs:install
3437
```
38+
## Dashboard
39+
40+
The Laravel-Failed-Jobs dashboard may be accessed via the `/failedjobs` route.
3541

3642
## Dashboard Authorization
3743

38-
Find `app/Providers/FailedJobsServiceProvider.php` and then follow the same tutorial here:
44+
Find `app/Providers/FailedJobsServiceProvider.php` and then follow the [same document of Horizon](https://laravel.com/docs/10.x/horizon#dashboard-authorization) to secure the dashboard in production environment.
45+
46+
![Screenshot 2024-02-01 at 7 54 17 PM](https://github.com/HPWebdeveloper/laravel-failed-jobs/assets/16323354/05abc4ab-ede6-4e90-b713-bc540015435d)
3947

40-
https://laravel.com/docs/10.x/horizon#dashboard-authorization
48+
![Screenshot 2024-02-01 at 7 55 27 PM](https://github.com/HPWebdeveloper/laravel-failed-jobs/assets/16323354/30e1dd9e-316b-4d8e-80a4-ef7df195bbcd)
4149

4250

4351
## Licensing

composer.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,6 @@
6262
"minimum-stability": "dev",
6363
"prefer-stable": true,
6464
"scripts": {
65-
"post-autoload-dump": "@prepare",
66-
"clear": "@php vendor/bin/testbench package:purge-skeleton --ansi",
67-
"prepare": "@php vendor/bin/testbench package:discover --ansi",
68-
"build": "@php vendor/bin/testbench workbench:build --ansi",
69-
"serve": [
70-
"@build",
71-
"@php vendor/bin/testbench serve"
72-
],
7365
"lint": [
7466
"@php vendor/bin/phpstan analyse"
7567
],

src/Http/Controllers/FailedJobsController.php

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class FailedJobsController extends Controller
1111

1212
public function index(Request $request)
1313
{
14-
$perPage = 50;
14+
$perPage = 50;
1515

1616
$failedJobs = DB::table('failed_jobs')
1717
->orderBy('failed_at', 'desc')
@@ -40,40 +40,6 @@ protected function decodeDatabaseFailedJob($job)
4040
return $job;
4141
}
4242

43-
44-
/**
45-
* Paginate the failed jobs for the request.
46-
*
47-
* @param \Illuminate\Http\Request $request
48-
* @return \Illuminate\Support\Collection
49-
*/
50-
protected function paginate(Request $request)
51-
{
52-
return $this->jobs->getFailed($request->query('starting_at') ?: -1)->map(function ($job) {
53-
return $this->decode($job);
54-
});
55-
}
56-
57-
/**
58-
* Paginate the failed jobs for the request and tag.
59-
*
60-
* @param \Illuminate\Http\Request $request
61-
* @param string $tag
62-
* @return \Illuminate\Support\Collection
63-
*/
64-
protected function paginateByTag(Request $request, $tag)
65-
{
66-
$jobIds = $this->tags->paginate(
67-
'failed:'.$tag, ($request->query('starting_at') ?: -1) + 1, 50
68-
);
69-
70-
$startingAt = $request->query('starting_at', 0);
71-
72-
return $this->jobs->getJobs($jobIds, $startingAt)->map(function ($job) {
73-
return $this->decode($job);
74-
});
75-
}
76-
7743
public function show($uuid)
7844
{
7945
$failedJob = DB::table('failed_jobs')->where('uuid', $uuid)->first();
@@ -98,24 +64,4 @@ protected function decodeDatabaseJob($job)
9864

9965
return $job;
10066
}
101-
102-
/**
103-
* Decode the given job.
104-
*
105-
* @param object $job
106-
* @return object
107-
*/
108-
protected function decode($job)
109-
{
110-
$job->payload = json_decode($job->payload);
111-
112-
$job->exception = mb_convert_encoding($job->exception, 'UTF-8');
113-
114-
$job->context = json_decode($job->context);
115-
116-
$job->retried_by = collect(json_decode($job->retried_by))
117-
->sortByDesc('retried_at')->values();
118-
119-
return $job;
120-
}
12167
}

0 commit comments

Comments
 (0)