| Server IP : 139.59.63.204 / Your IP : 216.73.217.62 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ubuntu-s-1vcpu-1gb-blr1-01 6.8.0-110-generic #110-Ubuntu SMP PREEMPT_DYNAMIC Thu Mar 19 15:09:20 UTC 2026 x86_64 User : root ( 0) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/abyogasms.com/vendor/laravel/pail/src/ |
Upload File : |
<?php
namespace Laravel\Pail;
use Illuminate\Console\Events\CommandStarting;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Log\Events\MessageLogged;
use Illuminate\Queue\Events\JobExceptionOccurred;
use Illuminate\Queue\Events\JobProcessed;
use Illuminate\Queue\Events\JobProcessing;
use Illuminate\Support\Env;
use Illuminate\Support\ServiceProvider;
use Laravel\Pail\Console\Commands\PailCommand;
class PailServiceProvider extends ServiceProvider
{
/**
* Registers the application services.
*/
public function register(): void
{
$this->app->singleton(
Files::class,
fn (Application $app) => new Files($app->storagePath('pail'))
);
$this->app->singleton(Handler::class, fn (Application $app) => new Handler(
$app,
$app->make(Files::class),
$app->runningInConsole(),
));
}
/**
* Bootstraps the application services.
*/
public function boot(): void
{
if (! $this->runningPailTests() && ($this->app->runningUnitTests() || ($_ENV['VAPOR_SSM_PATH'] ?? false))) {
return;
}
/** @var Dispatcher $events */
$events = $this->app->make('events');
$events->listen(MessageLogged::class, function (MessageLogged $messageLogged) {
/** @var Handler $handler */
$handler = $this->app->make(Handler::class);
$handler->log($messageLogged);
});
$events->listen([CommandStarting::class, JobProcessing::class, JobExceptionOccurred::class], function (CommandStarting|JobProcessing|JobExceptionOccurred $lifecycleEvent) {
/** @var Handler $handler */
$handler = $this->app->make(Handler::class);
$handler->setLastLifecycleEvent($lifecycleEvent);
});
$events->listen([JobProcessed::class], function () {
/** @var Handler $handler */
$handler = $this->app->make(Handler::class);
$handler->setLastLifecycleEvent(null);
});
if ($this->app->runningInConsole()) {
$this->commands([
PailCommand::class,
]);
}
}
/**
* Determines if the Pail's test suite is running.
*/
protected function runningPailTests(): bool
{
return (bool) (Env::get('PAIL_TESTS') ?? false);
}
}