horizon: notify admin is env var is set

This commit is contained in:
Víctor Falcón 2025-12-17 17:02:21 +01:00
parent d5d3c1ef1b
commit 9f5dedc8b9
2 changed files with 16 additions and 4 deletions

View File

@ -3,6 +3,7 @@
namespace App\Providers;
use Illuminate\Support\Facades\Gate;
use Laravel\Horizon\Horizon;
use Laravel\Horizon\HorizonApplicationServiceProvider;
class HorizonServiceProvider extends HorizonApplicationServiceProvider
@ -14,9 +15,9 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider
{
parent::boot();
// Horizon::routeSmsNotificationsTo('15556667777');
// Horizon::routeMailNotificationsTo('example@example.com');
// Horizon::routeSlackNotificationsTo('slack-webhook-url', '#channel');
if (config('horizon.notify_mail') !== null) {
Horizon::routeMailNotificationsTo(config('horizon.notify_mail'));
}
}
/**

View File

@ -69,7 +69,7 @@ return [
'prefix' => env(
'HORIZON_PREFIX',
Str::slug(env('APP_NAME', 'laravel'), '_').'_horizon:'
Str::slug(env('APP_NAME', 'laravel'), '_') . '_horizon:'
),
/*
@ -199,6 +199,17 @@ return [
'memory_limit' => 64,
/*
|--------------------------------------------------------------------------
| Notify mail
|--------------------------------------------------------------------------
|
| If you want to receive a mail when any queue is taking longer than
| because there more jobs that it can handle. Add and email here.
|
*/
'notify_mail' => env('HORIZON_NOTIFY_MAIL', null),
/*
|--------------------------------------------------------------------------
| Queue Worker Configuration