����JFIF��x�x����'
| Server IP : 78.140.185.180 / Your IP : 216.73.216.170 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/1630575/root/proc/1630575/root/home/builderbox/././www/vendor/laravel/horizon/src/ |
Upload File : |
<?php
namespace Laravel\Horizon;
use Closure;
use Exception;
use Illuminate\Support\Facades\File;
use RuntimeException;
class Horizon
{
/**
* The callback that should be used to authenticate Horizon users.
*
* @var \Closure
*/
public static $authUsing;
/**
* The Slack notifications webhook URL.
*
* @var string
*/
public static $slackWebhookUrl;
/**
* The Slack notifications channel.
*
* @var string
*/
public static $slackChannel;
/**
* The SMS notifications phone number.
*
* @var string
*/
public static $smsNumber;
/**
* The email address for notifications.
*
* @var string
*/
public static $email;
/**
* Indicates if Horizon should use the dark theme.
*
* @var bool
*/
public static $useDarkTheme = false;
/**
* The database configuration methods.
*
* @var array
*/
public static $databases = [
'Jobs', 'Supervisors', 'CommandQueue', 'Tags',
'Metrics', 'Locks', 'Processes',
];
/**
* Determine if the given request can access the Horizon dashboard.
*
* @param \Illuminate\Http\Request $request
* @return bool
*/
public static function check($request)
{
return (static::$authUsing ?: function () {
return app()->environment('local');
})($request);
}
/**
* Set the callback that should be used to authenticate Horizon users.
*
* @param \Closure $callback
* @return static
*/
public static function auth(Closure $callback)
{
static::$authUsing = $callback;
return new static;
}
/**
* Configure the Redis databases that will store Horizon data.
*
* @param string $connection
* @return void
* @throws Exception
*/
public static function use($connection)
{
if (! is_null($config = config("database.redis.clusters.{$connection}.0"))) {
config(["database.redis.{$connection}" => $config]);
} elseif (is_null($config) && is_null($config = config("database.redis.{$connection}"))) {
throw new Exception("Redis connection [{$connection}] has not been configured.");
}
config(['database.redis.horizon' => array_merge($config, [
'options' => ['prefix' => config('horizon.prefix') ?: 'horizon:'],
])]);
}
/**
* Specifies that Horizon should use the dark theme.
*
* @return static
*/
public static function night()
{
static::$useDarkTheme = true;
return new static;
}
/**
* Get the default JavaScript variables for Horizon.
*
* @return array
*/
public static function scriptVariables()
{
return [
'path' => config('horizon.path'),
];
}
/**
* Specify the email address to which email notifications should be routed.
*
* @param string $email
* @return static
*/
public static function routeMailNotificationsTo($email)
{
static::$email = $email;
return new static;
}
/**
* Specify the webhook URL and channel to which Slack notifications should be routed.
*
* @param string $url
* @param string $channel
* @return static
*/
public static function routeSlackNotificationsTo($url, $channel = null)
{
static::$slackWebhookUrl = $url;
static::$slackChannel = $channel;
return new static;
}
/**
* Specify the phone number to which SMS notifications should be routed.
*
* @param string $number
* @return static
*/
public static function routeSmsNotificationsTo($number)
{
static::$smsNumber = $number;
return new static;
}
/**
* Determine if Horizon's published assets are up-to-date.
*
* @return bool
*
* @throws \RuntimeException
*/
public static function assetsAreCurrent()
{
$publishedPath = public_path('vendor/horizon/mix-manifest.json');
if (! File::exists($publishedPath)) {
throw new RuntimeException('Horizon assets are not published. Please run: php artisan horizon:publish');
}
return File::get($publishedPath) === File::get(__DIR__.'/../public/mix-manifest.json');
}
}