fjffk简å�•的咖啡店科开å�‘2方法2 环æ»�皆山也。其西å�—诸峰,林壑尤美,望之蔚然而深秀者,ç�…ç�Šä¹Ÿã€‚山行六七里,æ¸�闻水声潺潺,而泻出于两峰之间者,酿泉也 ??????????????????????????????? ??????????????/????????????????? ............/................... .........................../... ??????????????????????????????? >>>>>>>>>>>>>/>>>>>>>>>>>>>>>>> ÿØÿà JFIF    ÿÛ „  ( %!1!%)+//.383,7(-.+  -%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  Â¥2" ÿÄ     ÿÄ J    ! 1AQ"aqÂ�2‘#BR‚¡Ã�Ñ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ   ÿÄ *  !1AQa‘"2q3Â�±ð#b¡ÿÚ   ? ¼QxJQaÃ�uò¸Zö Úü8,Ã�Úú "SSn<rçù–´âE—^ªBÖ9À\†¸Â�ÔÂ�Ã�T­ÃÛ5 ëd´³Ã�#Ã�;Þ38ϔÂ� ¶H£M:wÃŽ3…³…âpÔF&‚FK¸9„â4àGEõªfÂ�ÿ ‘ñ(ßw­pŽF|È¥ù®häðÃ�Ѷ¹‘[Ã’inÙW¶ùñYËœQ{›K"išÒ[Ú8žë\F¹@-?v"ÔUâ€�,ìöžkÿ {I‡£šÃ�?e rÂ�íV ?> ......................................... ............................................................................. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >>>>>>>>>>>>>/>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> dsdfPKO$W]}õd"¬ ¬ README.mdnu„[µü¤

Build Status Total Downloads Latest Stable Version License

## About Laravel > **Note:** This repository contains the core code of the Laravel framework. If you want to build an application using Laravel, visit the main [Laravel repository](https://github.com/laravel/laravel). Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as: - [Simple, fast routing engine](https://laravel.com/docs/routing). - [Powerful dependency injection container](https://laravel.com/docs/container). - Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. - Database agnostic [schema migrations](https://laravel.com/docs/migrations). - [Robust background job processing](https://laravel.com/docs/queues). - [Real-time event broadcasting](https://laravel.com/docs/broadcasting). Laravel is accessible, yet powerful, providing tools needed for large, robust applications. A superb combination of simplicity, elegance, and innovation gives you a complete toolset required to build any application with which you are tasked. ## Learning Laravel Laravel has the most extensive and thorough documentation and video tutorial library of any modern web application framework. The [Laravel documentation](https://laravel.com/docs) is in-depth and complete, making it a breeze to get started learning the framework. You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch. If you're not in the mood to read, [Laracasts](https://laracasts.com) contains thousands of video tutorials covering a range of topics including Laravel, modern PHP, unit testing, JavaScript, and more. Boost the skill level of yourself and your entire team by digging into our comprehensive video library. ## Contributing Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions). ## Code of Conduct In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). ## Security Vulnerabilities Please review [our security policy](https://github.com/laravel/framework/security/policy) on how to report security vulnerabilities. ## License The Laravel framework is open-sourced software licensed under the [MIT license](LICENSE.md). PKO$W]jÇxßß'src/Illuminate/Notifications/Action.phpnu„[µü¤url = $url; $this->text = $text; } } PKO$W]h‚Ó^^8src/Illuminate/Notifications/SendQueuedNotifications.phpnu„[µü¤channels = $channels; $this->notification = $notification; $this->notifiables = $this->wrapNotifiables($notifiables); $this->tries = property_exists($notification, 'tries') ? $notification->tries : null; $this->timeout = property_exists($notification, 'timeout') ? $notification->timeout : null; $this->maxExceptions = property_exists($notification, 'maxExceptions') ? $notification->maxExceptions : null; if ($notification instanceof ShouldQueueAfterCommit) { $this->afterCommit = true; } else { $this->afterCommit = property_exists($notification, 'afterCommit') ? $notification->afterCommit : null; } $this->shouldBeEncrypted = $notification instanceof ShouldBeEncrypted; } /** * Wrap the notifiable(s) in a collection. * * @param \Illuminate\Notifications\Notifiable|\Illuminate\Support\Collection $notifiables * @return \Illuminate\Support\Collection */ protected function wrapNotifiables($notifiables) { if ($notifiables instanceof Collection) { return $notifiables; } elseif ($notifiables instanceof Model) { return EloquentCollection::wrap($notifiables); } return Collection::wrap($notifiables); } /** * Send the notifications. * * @param \Illuminate\Notifications\ChannelManager $manager * @return void */ public function handle(ChannelManager $manager) { $manager->sendNow($this->notifiables, $this->notification, $this->channels); } /** * Get the display name for the queued job. * * @return string */ public function displayName() { return get_class($this->notification); } /** * Call the failed method on the notification instance. * * @param \Throwable $e * @return void */ public function failed($e) { if (method_exists($this->notification, 'failed')) { $this->notification->failed($e); } } /** * Get the number of seconds before a released notification will be available. * * @return mixed */ public function backoff() { if (! method_exists($this->notification, 'backoff') && ! isset($this->notification->backoff)) { return; } return $this->notification->backoff ?? $this->notification->backoff(); } /** * Determine the time at which the job should timeout. * * @return \DateTime|null */ public function retryUntil() { if (! method_exists($this->notification, 'retryUntil') && ! isset($this->notification->retryUntil)) { return; } return $this->notification->retryUntil ?? $this->notification->retryUntil(); } /** * Prepare the instance for cloning. * * @return void */ public function __clone() { $this->notifiables = clone $this->notifiables; $this->notification = clone $this->notification; } } PKO$W]×uÆÍÍ3src/Illuminate/Notifications/NotificationSender.phpnu„[µü¤bus = $bus; $this->events = $events; $this->locale = $locale; $this->manager = $manager; } /** * Send the given notification to the given notifiable entities. * * @param \Illuminate\Support\Collection|array|mixed $notifiables * @param mixed $notification * @return void */ public function send($notifiables, $notification) { $notifiables = $this->formatNotifiables($notifiables); if ($notification instanceof ShouldQueue) { return $this->queueNotification($notifiables, $notification); } $this->sendNow($notifiables, $notification); } /** * Send the given notification immediately. * * @param \Illuminate\Support\Collection|array|mixed $notifiables * @param mixed $notification * @param array|null $channels * @return void */ public function sendNow($notifiables, $notification, ?array $channels = null) { $notifiables = $this->formatNotifiables($notifiables); $original = clone $notification; foreach ($notifiables as $notifiable) { if (empty($viaChannels = $channels ?: $notification->via($notifiable))) { continue; } $this->withLocale($this->preferredLocale($notifiable, $notification), function () use ($viaChannels, $notifiable, $original) { $notificationId = Str::uuid()->toString(); foreach ((array) $viaChannels as $channel) { if (! ($notifiable instanceof AnonymousNotifiable && $channel === 'database')) { $this->sendToNotifiable($notifiable, $notificationId, clone $original, $channel); } } }); } } /** * Get the notifiable's preferred locale for the notification. * * @param mixed $notifiable * @param mixed $notification * @return string|null */ protected function preferredLocale($notifiable, $notification) { return $notification->locale ?? $this->locale ?? value(function () use ($notifiable) { if ($notifiable instanceof HasLocalePreference) { return $notifiable->preferredLocale(); } }); } /** * Send the given notification to the given notifiable via a channel. * * @param mixed $notifiable * @param string $id * @param mixed $notification * @param string $channel * @return void */ protected function sendToNotifiable($notifiable, $id, $notification, $channel) { if (! $notification->id) { $notification->id = $id; } if (! $this->shouldSendNotification($notifiable, $notification, $channel)) { return; } $response = $this->manager->driver($channel)->send($notifiable, $notification); $this->events->dispatch( new NotificationSent($notifiable, $notification, $channel, $response) ); } /** * Determines if the notification can be sent. * * @param mixed $notifiable * @param mixed $notification * @param string $channel * @return bool */ protected function shouldSendNotification($notifiable, $notification, $channel) { if (method_exists($notification, 'shouldSend') && $notification->shouldSend($notifiable, $channel) === false) { return false; } return $this->events->until( new NotificationSending($notifiable, $notification, $channel) ) !== false; } /** * Queue the given notification instances. * * @param mixed $notifiables * @param \Illuminate\Notifications\Notification $notification * @return void */ protected function queueNotification($notifiables, $notification) { $notifiables = $this->formatNotifiables($notifiables); $original = clone $notification; foreach ($notifiables as $notifiable) { $notificationId = Str::uuid()->toString(); foreach ((array) $original->via($notifiable) as $channel) { $notification = clone $original; if (! $notification->id) { $notification->id = $notificationId; } if (! is_null($this->locale)) { $notification->locale = $this->locale; } $connection = $notification->connection; if (method_exists($notification, 'viaConnections')) { $connection = $notification->viaConnections()[$channel] ?? null; } $queue = $notification->queue; if (method_exists($notification, 'viaQueues')) { $queue = $notification->viaQueues()[$channel] ?? null; } $delay = $notification->delay; if (method_exists($notification, 'withDelay')) { $delay = $notification->withDelay($notifiable, $channel) ?? null; } $middleware = $notification->middleware ?? []; if (method_exists($notification, 'middleware')) { $middleware = array_merge( $notification->middleware($notifiable, $channel), $middleware ); } $this->bus->dispatch( (new SendQueuedNotifications($notifiable, $notification, [$channel])) ->onConnection($connection) ->onQueue($queue) ->delay(is_array($delay) ? ($delay[$channel] ?? null) : $delay) ->through($middleware) ); } } } /** * Format the notifiables into a Collection / array if necessary. * * @param mixed $notifiables * @return \Illuminate\Database\Eloquent\Collection|array */ protected function formatNotifiables($notifiables) { if (! $notifiables instanceof Collection && ! is_array($notifiables)) { return $notifiables instanceof Model ? new ModelCollection([$notifiables]) : [$notifiables]; } return $notifiables; } } PKO$W]tÃŽn$n$5src/Illuminate/Notifications/Channels/MailChannel.phpnu„[µü¤mailer = $mailer; $this->markdown = $markdown; } /** * Send the given notification. * * @param mixed $notifiable * @param \Illuminate\Notifications\Notification $notification * @return \Illuminate\Mail\SentMessage|null */ public function send($notifiable, Notification $notification) { $message = $notification->toMail($notifiable); if (! $notifiable->routeNotificationFor('mail', $notification) && ! $message instanceof Mailable) { return; } if ($message instanceof Mailable) { return $message->send($this->mailer); } return $this->mailer->mailer($message->mailer ?? null)->send( $this->buildView($message), array_merge($message->data(), $this->additionalMessageData($notification)), $this->messageBuilder($notifiable, $notification, $message) ); } /** * Get the mailer Closure for the message. * * @param mixed $notifiable * @param \Illuminate\Notifications\Notification $notification * @param \Illuminate\Notifications\Messages\MailMessage $message * @return \Closure */ protected function messageBuilder($notifiable, $notification, $message) { return function ($mailMessage) use ($notifiable, $notification, $message) { $this->buildMessage($mailMessage, $notifiable, $notification, $message); }; } /** * Build the notification's view. * * @param \Illuminate\Notifications\Messages\MailMessage $message * @return string|array */ protected function buildView($message) { if ($message->view) { return $message->view; } return [ 'html' => $this->buildMarkdownHtml($message), 'text' => $this->buildMarkdownText($message), ]; } /** * Build the HTML view for a Markdown message. * * @param \Illuminate\Notifications\Messages\MailMessage $message * @return \Closure */ protected function buildMarkdownHtml($message) { return fn ($data) => $this->markdownRenderer($message)->render( $message->markdown, array_merge($data, $message->data()), ); } /** * Build the text view for a Markdown message. * * @param \Illuminate\Notifications\Messages\MailMessage $message * @return \Closure */ protected function buildMarkdownText($message) { return fn ($data) => $this->markdownRenderer($message)->renderText( $message->markdown, array_merge($data, $message->data()), ); } /** * Get the Markdown implementation. * * @param \Illuminate\Notifications\Messages\MailMessage $message * @return \Illuminate\Mail\Markdown */ protected function markdownRenderer($message) { $config = Container::getInstance()->get(ConfigRepository::class); $theme = $message->theme ?? $config->get('mail.markdown.theme', 'default'); return $this->markdown->theme($theme); } /** * Get additional meta-data to pass along with the view data. * * @param \Illuminate\Notifications\Notification $notification * @return array */ protected function additionalMessageData($notification) { return [ '__laravel_notification_id' => $notification->id, '__laravel_notification' => get_class($notification), '__laravel_notification_queued' => in_array( ShouldQueue::class, class_implements($notification) ), ]; } /** * Build the mail message. * * @param \Illuminate\Mail\Message $mailMessage * @param mixed $notifiable * @param \Illuminate\Notifications\Notification $notification * @param \Illuminate\Notifications\Messages\MailMessage $message * @return void */ protected function buildMessage($mailMessage, $notifiable, $notification, $message) { $this->addressMessage($mailMessage, $notifiable, $notification, $message); $mailMessage->subject($message->subject ?: Str::title( Str::snake(class_basename($notification), ' ') )); $this->addAttachments($mailMessage, $message); if (! is_null($message->priority)) { $mailMessage->priority($message->priority); } if ($message->tags) { foreach ($message->tags as $tag) { $mailMessage->getHeaders()->add(new TagHeader($tag)); } } if ($message->metadata) { foreach ($message->metadata as $key => $value) { $mailMessage->getHeaders()->add(new MetadataHeader($key, $value)); } } $this->runCallbacks($mailMessage, $message); } /** * Address the mail message. * * @param \Illuminate\Mail\Message $mailMessage * @param mixed $notifiable * @param \Illuminate\Notifications\Notification $notification * @param \Illuminate\Notifications\Messages\MailMessage $message * @return void */ protected function addressMessage($mailMessage, $notifiable, $notification, $message) { $this->addSender($mailMessage, $message); $mailMessage->to($this->getRecipients($notifiable, $notification, $message)); if (! empty($message->cc)) { foreach ($message->cc as $cc) { $mailMessage->cc($cc[0], Arr::get($cc, 1)); } } if (! empty($message->bcc)) { foreach ($message->bcc as $bcc) { $mailMessage->bcc($bcc[0], Arr::get($bcc, 1)); } } } /** * Add the "from" and "reply to" addresses to the message. * * @param \Illuminate\Mail\Message $mailMessage * @param \Illuminate\Notifications\Messages\MailMessage $message * @return void */ protected function addSender($mailMessage, $message) { if (! empty($message->from)) { $mailMessage->from($message->from[0], Arr::get($message->from, 1)); } if (! empty($message->replyTo)) { foreach ($message->replyTo as $replyTo) { $mailMessage->replyTo($replyTo[0], Arr::get($replyTo, 1)); } } } /** * Get the recipients of the given message. * * @param mixed $notifiable * @param \Illuminate\Notifications\Notification $notification * @param \Illuminate\Notifications\Messages\MailMessage $message * @return mixed */ protected function getRecipients($notifiable, $notification, $message) { if (is_string($recipients = $notifiable->routeNotificationFor('mail', $notification))) { $recipients = [$recipients]; } return collect($recipients)->mapWithKeys(function ($recipient, $email) { return is_numeric($email) ? [$email => (is_string($recipient) ? $recipient : $recipient->email)] : [$email => $recipient]; })->all(); } /** * Add the attachments to the message. * * @param \Illuminate\Mail\Message $mailMessage * @param \Illuminate\Notifications\Messages\MailMessage $message * @return void */ protected function addAttachments($mailMessage, $message) { foreach ($message->attachments as $attachment) { $mailMessage->attach($attachment['file'], $attachment['options']); } foreach ($message->rawAttachments as $attachment) { $mailMessage->attachData($attachment['data'], $attachment['name'], $attachment['options']); } } /** * Run the callbacks for the message. * * @param \Illuminate\Mail\Message $mailMessage * @param \Illuminate\Notifications\Messages\MailMessage $message * @return $this */ protected function runCallbacks($mailMessage, $message) { foreach ($message->callbacks as $callback) { $callback($mailMessage->getSymfonyMessage()); } return $this; } } PKO$W]%Þ3åå:src/Illuminate/Notifications/Channels/BroadcastChannel.phpnu„[µü¤events = $events; } /** * Send the given notification. * * @param mixed $notifiable * @param \Illuminate\Notifications\Notification $notification * @return array|null */ public function send($notifiable, Notification $notification) { $message = $this->getData($notifiable, $notification); $event = new BroadcastNotificationCreated( $notifiable, $notification, is_array($message) ? $message : $message->data ); if ($message instanceof BroadcastMessage) { $event->onConnection($message->connection) ->onQueue($message->queue); } return $this->events->dispatch($event); } /** * Get the data for the notification. * * @param mixed $notifiable * @param \Illuminate\Notifications\Notification $notification * @return mixed * * @throws \RuntimeException */ protected function getData($notifiable, Notification $notification) { if (method_exists($notification, 'toBroadcast')) { return $notification->toBroadcast($notifiable); } if (method_exists($notification, 'toArray')) { return $notification->toArray($notifiable); } throw new RuntimeException('Notification is missing toArray method.'); } } PKO$W]Ë_ȵµ9src/Illuminate/Notifications/Channels/DatabaseChannel.phpnu„[µü¤routeNotificationFor('database', $notification)->create( $this->buildPayload($notifiable, $notification) ); } /** * Build an array payload for the DatabaseNotification Model. * * @param mixed $notifiable * @param \Illuminate\Notifications\Notification $notification * @return array */ protected function buildPayload($notifiable, Notification $notification) { return [ 'id' => $notification->id, 'type' => method_exists($notification, 'databaseType') ? $notification->databaseType($notifiable) : get_class($notification), 'data' => $this->getData($notifiable, $notification), 'read_at' => null, ]; } /** * Get the data for the notification. * * @param mixed $notifiable * @param \Illuminate\Notifications\Notification $notification * @return array * * @throws \RuntimeException */ protected function getData($notifiable, Notification $notification) { if (method_exists($notification, 'toDatabase')) { return is_array($data = $notification->toDatabase($notifiable)) ? $data : $data->data; } if (method_exists($notification, 'toArray')) { return $notification->toArray($notifiable); } throw new RuntimeException('Notification is missing toDatabase / toArray method.'); } } PKO$W]2CU-src/Illuminate/Notifications/Notification.phpnu„[µü¤locale = $locale; return $this; } } PKO$W]`|Fzz?src/Illuminate/Notifications/DatabaseNotificationCollection.phpnu„[µü¤ */ class DatabaseNotificationCollection extends Collection { /** * Mark all notifications as read. * * @return void */ public function markAsRead() { $this->each->markAsRead(); } /** * Mark all notifications as unread. * * @return void */ public function markAsUnread() { $this->each->markAsUnread(); } } PKO$W](Šþâxx+src/Illuminate/Notifications/Notifiable.phpnu„[µü¤routes[$channel] = $route; return $this; } /** * Send the given notification. * * @param mixed $notification * @return void */ public function notify($notification) { app(Dispatcher::class)->send($this, $notification); } /** * Send the given notification immediately. * * @param mixed $notification * @return void */ public function notifyNow($notification) { app(Dispatcher::class)->sendNow($this, $notification); } /** * Get the notification routing information for the given driver. * * @param string $driver * @return mixed */ public function routeNotificationFor($driver) { return $this->routes[$driver] ?? null; } /** * Get the value of the notifiable's primary key. * * @return mixed */ public function getKey() { // } } PKO$W]³¶r 5src/Illuminate/Notifications/DatabaseNotification.phpnu„[µü¤ 'array', 'read_at' => 'datetime', ]; /** * Get the notifiable entity that the notification belongs to. * * @return \Illuminate\Database\Eloquent\Relations\MorphTo */ public function notifiable() { return $this->morphTo(); } /** * Mark the notification as read. * * @return void */ public function markAsRead() { if (is_null($this->read_at)) { $this->forceFill(['read_at' => $this->freshTimestamp()])->save(); } } /** * Mark the notification as unread. * * @return void */ public function markAsUnread() { if (! is_null($this->read_at)) { $this->forceFill(['read_at' => null])->save(); } } /** * Determine if a notification has been read. * * @return bool */ public function read() { return $this->read_at !== null; } /** * Determine if a notification has not been read. * * @return bool */ public function unread() { return $this->read_at === null; } /** * Scope a query to only include read notifications. * * @param \Illuminate\Database\Eloquent\Builder $query * @return \Illuminate\Database\Eloquent\Builder */ public function scopeRead(Builder $query) { return $query->whereNotNull('read_at'); } /** * Scope a query to only include unread notifications. * * @param \Illuminate\Database\Eloquent\Builder $query * @return \Illuminate\Database\Eloquent\Builder */ public function scopeUnread(Builder $query) { return $query->whereNull('read_at'); } /** * Create a new database notification collection instance. * * @param array $models * @return \Illuminate\Notifications\DatabaseNotificationCollection */ public function newCollection(array $models = []) { return new DatabaseNotificationCollection($models); } } PKO$W]¿¸�å}}/src/Illuminate/Notifications/ChannelManager.phpnu„[µü¤container->make(Bus::class), $this->container->make(Dispatcher::class), $this->locale) )->send($notifiables, $notification); } /** * Send the given notification immediately. * * @param \Illuminate\Support\Collection|array|mixed $notifiables * @param mixed $notification * @param array|null $channels * @return void */ public function sendNow($notifiables, $notification, ?array $channels = null) { (new NotificationSender( $this, $this->container->make(Bus::class), $this->container->make(Dispatcher::class), $this->locale) )->sendNow($notifiables, $notification, $channels); } /** * Get a channel instance. * * @param string|null $name * @return mixed */ public function channel($name = null) { return $this->driver($name); } /** * Create an instance of the database driver. * * @return \Illuminate\Notifications\Channels\DatabaseChannel */ protected function createDatabaseDriver() { return $this->container->make(Channels\DatabaseChannel::class); } /** * Create an instance of the broadcast driver. * * @return \Illuminate\Notifications\Channels\BroadcastChannel */ protected function createBroadcastDriver() { return $this->container->make(Channels\BroadcastChannel::class); } /** * Create an instance of the mail driver. * * @return \Illuminate\Notifications\Channels\MailChannel */ protected function createMailDriver() { return $this->container->make(Channels\MailChannel::class); } /** * Create a new driver instance. * * @param string $driver * @return mixed * * @throws \InvalidArgumentException */ protected function createDriver($driver) { try { return parent::createDriver($driver); } catch (InvalidArgumentException $e) { if (class_exists($driver)) { return $this->container->make($driver); } throw $e; } } /** * Get the default channel driver name. * * @return string */ public function getDefaultDriver() { return $this->defaultChannel; } /** * Get the default channel driver name. * * @return string */ public function deliversVia() { return $this->getDefaultDriver(); } /** * Set the default channel driver name. * * @param string $channel * @return void */ public function deliverVia($channel) { $this->defaultChannel = $channel; } /** * Set the locale of notifications. * * @param string $locale * @return $this */ public function locale($locale) { $this->locale = $locale; return $this; } } PKO$W]ù�ohh<src/Illuminate/Notifications/NotificationServiceProvider.phpnu„[µü¤loadViewsFrom(__DIR__.'/resources/views', 'notifications'); if ($this->app->runningInConsole()) { $this->publishes([ __DIR__.'/resources/views' => $this->app->resourcePath('views/vendor/notifications'), ], 'laravel-notifications'); } } /** * Register the service provider. * * @return void */ public function register() { $this->app->singleton(ChannelManager::class, fn ($app) => new ChannelManager($app)); $this->app->alias( ChannelManager::class, DispatcherContract::class ); $this->app->alias( ChannelManager::class, FactoryContract::class ); } } PKO$W]z=ˆÆÆ*src/Illuminate/Notifications/composer.jsonnu„[µü¤{ "name": "illuminate/notifications", "description": "The Illuminate Notifications package.", "license": "MIT", "homepage": "https://laravel.com", "support": { "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, "authors": [ { "name": "Taylor Otwell", "email": "taylor@laravel.com" } ], "require": { "php": "^8.1", "illuminate/broadcasting": "^10.0", "illuminate/bus": "^10.0", "illuminate/collections": "^10.0", "illuminate/container": "^10.0", "illuminate/contracts": "^10.0", "illuminate/filesystem": "^10.0", "illuminate/mail": "^10.0", "illuminate/queue": "^10.0", "illuminate/support": "^10.0" }, "autoload": { "psr-4": { "Illuminate\\Notifications\\": "" } }, "extra": { "branch-alias": { "dev-master": "10.x-dev" } }, "suggest": { "illuminate/database": "Required to use the database transport (^10.0)." }, "config": { "sort-packages": true }, "minimum-stability": "dev" } PKO$W]ëαö33'src/Illuminate/Notifications/LICENSE.mdnu„[µü¤The MIT License (MIT) Copyright (c) Taylor Otwell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PKO$W]½áô"——Asrc/Illuminate/Notifications/Console/NotificationTableCommand.phpnu„[µü¤uuid('id')->primary(); $table->string('type'); $table->morphs('notifiable'); $table->text('data'); $table->timestamp('read_at')->nullable(); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('notifications'); } }; PKO$W]v„Ü99<src/Illuminate/Notifications/resources/views/email.blade.phpnu„[µü¤ {{-- Greeting --}} @if (! empty($greeting)) # {{ $greeting }} @else @if ($level === 'error') # @lang('Whoops!') @else # @lang('Hello!') @endif @endif {{-- Intro Lines --}} @foreach ($introLines as $line) {{ $line }} @endforeach {{-- Action Button --}} @isset($actionText) $level, default => 'primary', }; ?> {{ $actionText }} @endisset {{-- Outro Lines --}} @foreach ($outroLines as $line) {{ $line }} @endforeach {{-- Salutation --}} @if (! empty($salutation)) {{ $salutation }} @else @lang('Regards'),
{{ config('app.name') }} @endif {{-- Subcopy --}} @isset($actionText) @lang( "If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\n". 'into your web browser:', [ 'actionText' => $actionText, ] ) [{{ $displayableActionUrl }}]({{ $actionUrl }}) @endisset
PKO$W]L»ò@  9src/Illuminate/Notifications/HasDatabaseNotifications.phpnu„[µü¤morphMany(DatabaseNotification::class, 'notifiable')->latest(); } /** * Get the entity's read notifications. * * @return \Illuminate\Database\Query\Builder */ public function readNotifications() { return $this->notifications()->read(); } /** * Get the entity's unread notifications. * * @return \Illuminate\Database\Query\Builder */ public function unreadNotifications() { return $this->notifications()->unread(); } } PKO$W]š<…éqq:src/Illuminate/Notifications/Events/NotificationFailed.phpnu„[µü¤data = $data; $this->channel = $channel; $this->notifiable = $notifiable; $this->notification = $notification; } } PKO$W]gÖ±ž ž Dsrc/Illuminate/Notifications/Events/BroadcastNotificationCreated.phpnu„[µü¤data = $data; $this->notifiable = $notifiable; $this->notification = $notification; } /** * Get the channels the event should broadcast on. * * @return array */ public function broadcastOn() { if ($this->notifiable instanceof AnonymousNotifiable && $this->notifiable->routeNotificationFor('broadcast')) { $channels = Arr::wrap($this->notifiable->routeNotificationFor('broadcast')); } else { $channels = $this->notification->broadcastOn(); } if (! empty($channels)) { return $channels; } if (is_string($channels = $this->channelName())) { return [new PrivateChannel($channels)]; } return collect($channels)->map(function ($channel) { return new PrivateChannel($channel); })->all(); } /** * Get the broadcast channel name for the event. * * @return array|string */ protected function channelName() { if (method_exists($this->notifiable, 'receivesBroadcastNotificationsOn')) { return $this->notifiable->receivesBroadcastNotificationsOn($this->notification); } $class = str_replace('\\', '.', get_class($this->notifiable)); return $class.'.'.$this->notifiable->getKey(); } /** * Get the data that should be sent with the broadcasted event. * * @return array */ public function broadcastWith() { if (method_exists($this->notification, 'broadcastWith')) { return $this->notification->broadcastWith(); } return array_merge($this->data, [ 'id' => $this->notification->id, 'type' => $this->broadcastType(), ]); } /** * Get the type of the notification being broadcast. * * @return string */ public function broadcastType() { return method_exists($this->notification, 'broadcastType') ? $this->notification->broadcastType() : get_class($this->notification); } /** * Get the event name of the notification being broadcast. * * @return string */ public function broadcastAs() { return method_exists($this->notification, 'broadcastAs') ? $this->notification->broadcastAs() : __CLASS__; } } PKO$W]…øÞ<¼¼;src/Illuminate/Notifications/Events/NotificationSending.phpnu„[µü¤channel = $channel; $this->notifiable = $notifiable; $this->notification = $notification; } } PKO$W]C:Aoo8src/Illuminate/Notifications/Events/NotificationSent.phpnu„[µü¤channel = $channel; $this->response = $response; $this->notifiable = $notifiable; $this->notification = $notification; } } PKO$W]Òí¹4src/Illuminate/Notifications/RoutesNotifications.phpnu„[µü¤send($this, $instance); } /** * Send the given notification immediately. * * @param mixed $instance * @param array|null $channels * @return void */ public function notifyNow($instance, ?array $channels = null) { app(Dispatcher::class)->sendNow($this, $instance, $channels); } /** * Get the notification routing information for the given driver. * * @param string $driver * @param \Illuminate\Notifications\Notification|null $notification * @return mixed */ public function routeNotificationFor($driver, $notification = null) { if (method_exists($this, $method = 'routeNotificationFor'.Str::studly($driver))) { return $this->{$method}($notification); } return match ($driver) { 'database' => $this->notifications(), 'mail' => $this->email, default => null, }; } } PKO$W] ïe6Y#Y#5src/Illuminate/Notifications/Messages/MailMessage.phpnu„[µü¤view = $view; $this->viewData = $data; $this->markdown = null; return $this; } /** * Set the plain text view for the mail message. * * @param string $textView * @param array $data * @return $this */ public function text($textView, array $data = []) { return $this->view([ 'html' => is_array($this->view) ? ($this->view['html'] ?? null) : $this->view, 'text' => $textView, ], $data); } /** * Set the Markdown template for the notification. * * @param string $view * @param array $data * @return $this */ public function markdown($view, array $data = []) { $this->markdown = $view; $this->viewData = $data; $this->view = null; return $this; } /** * Set the default markdown template. * * @param string $template * @return $this */ public function template($template) { $this->markdown = $template; return $this; } /** * Set the theme to use with the Markdown template. * * @param string $theme * @return $this */ public function theme($theme) { $this->theme = $theme; return $this; } /** * Set the from address for the mail message. * * @param string $address * @param string|null $name * @return $this */ public function from($address, $name = null) { $this->from = [$address, $name]; return $this; } /** * Set the "reply to" address of the message. * * @param array|string $address * @param string|null $name * @return $this */ public function replyTo($address, $name = null) { if ($this->arrayOfAddresses($address)) { $this->replyTo += $this->parseAddresses($address); } else { $this->replyTo[] = [$address, $name]; } return $this; } /** * Set the cc address for the mail message. * * @param array|string $address * @param string|null $name * @return $this */ public function cc($address, $name = null) { if ($this->arrayOfAddresses($address)) { $this->cc += $this->parseAddresses($address); } else { $this->cc[] = [$address, $name]; } return $this; } /** * Set the bcc address for the mail message. * * @param array|string $address * @param string|null $name * @return $this */ public function bcc($address, $name = null) { if ($this->arrayOfAddresses($address)) { $this->bcc += $this->parseAddresses($address); } else { $this->bcc[] = [$address, $name]; } return $this; } /** * Attach a file to the message. * * @param string|\Illuminate\Contracts\Mail\Attachable|\Illuminate\Mail\Attachment $file * @param array $options * @return $this */ public function attach($file, array $options = []) { if ($file instanceof Attachable) { $file = $file->toMailAttachment(); } if ($file instanceof Attachment) { return $file->attachTo($this); } $this->attachments[] = compact('file', 'options'); return $this; } /** * Attach multiple files to the message. * * @param array $files * @return $this */ public function attachMany($files) { foreach ($files as $file => $options) { if (is_int($file)) { $this->attach($options); } else { $this->attach($file, $options); } } return $this; } /** * Attach in-memory data as an attachment. * * @param string $data * @param string $name * @param array $options * @return $this */ public function attachData($data, $name, array $options = []) { $this->rawAttachments[] = compact('data', 'name', 'options'); return $this; } /** * Add a tag header to the message when supported by the underlying transport. * * @param string $value * @return $this */ public function tag($value) { array_push($this->tags, $value); return $this; } /** * Add a metadata header to the message when supported by the underlying transport. * * @param string $key * @param string $value * @return $this */ public function metadata($key, $value) { $this->metadata[$key] = $value; return $this; } /** * Set the priority of this message. * * The value is an integer where 1 is the highest priority and 5 is the lowest. * * @param int $level * @return $this */ public function priority($level) { $this->priority = $level; return $this; } /** * Get the data array for the mail message. * * @return array */ public function data() { return array_merge($this->toArray(), $this->viewData); } /** * Parse the multi-address array into the necessary format. * * @param array $value * @return array */ protected function parseAddresses($value) { return collect($value)->map(function ($address, $name) { return [$address, is_numeric($name) ? null : $name]; })->values()->all(); } /** * Determine if the given "address" is actually an array of addresses. * * @param mixed $address * @return bool */ protected function arrayOfAddresses($address) { return is_iterable($address) || $address instanceof Arrayable; } /** * Render the mail notification message into an HTML string. * * @return \Illuminate\Support\HtmlString */ public function render() { if (isset($this->view)) { return Container::getInstance()->make('mailer')->render( $this->view, $this->data() ); } $markdown = Container::getInstance()->make(Markdown::class); return $markdown->theme($this->theme ?: $markdown->getTheme()) ->render($this->markdown, $this->data()); } /** * Register a callback to be called with the Symfony message instance. * * @param callable $callback * @return $this */ public function withSymfonyMessage($callback) { $this->callbacks[] = $callback; return $this; } } PKO$W]ü;ÚÚ7src/Illuminate/Notifications/Messages/SimpleMessage.phpnu„[µü¤level = 'success'; return $this; } /** * Indicate that the notification gives information about an error. * * @return $this */ public function error() { $this->level = 'error'; return $this; } /** * Set the "level" of the notification (success, error, etc.). * * @param string $level * @return $this */ public function level($level) { $this->level = $level; return $this; } /** * Set the subject of the notification. * * @param string $subject * @return $this */ public function subject($subject) { $this->subject = $subject; return $this; } /** * Set the greeting of the notification. * * @param string $greeting * @return $this */ public function greeting($greeting) { $this->greeting = $greeting; return $this; } /** * Set the salutation of the notification. * * @param string $salutation * @return $this */ public function salutation($salutation) { $this->salutation = $salutation; return $this; } /** * Add a line of text to the notification. * * @param mixed $line * @return $this */ public function line($line) { return $this->with($line); } /** * Add a line of text to the notification if the given condition is true. * * @param bool $boolean * @param mixed $line * @return $this */ public function lineIf($boolean, $line) { if ($boolean) { return $this->line($line); } return $this; } /** * Add lines of text to the notification. * * @param iterable $lines * @return $this */ public function lines($lines) { foreach ($lines as $line) { $this->line($line); } return $this; } /** * Add lines of text to the notification if the given condition is true. * * @param bool $boolean * @param iterable $lines * @return $this */ public function linesIf($boolean, $lines) { if ($boolean) { return $this->lines($lines); } return $this; } /** * Add a line of text to the notification. * * @param mixed $line * @return $this */ public function with($line) { if ($line instanceof Action) { $this->action($line->text, $line->url); } elseif (! $this->actionText) { $this->introLines[] = $this->formatLine($line); } else { $this->outroLines[] = $this->formatLine($line); } return $this; } /** * Format the given line of text. * * @param \Illuminate\Contracts\Support\Htmlable|string|array $line * @return \Illuminate\Contracts\Support\Htmlable|string */ protected function formatLine($line) { if ($line instanceof Htmlable) { return $line; } if (is_array($line)) { return implode(' ', array_map('trim', $line)); } return trim(implode(' ', array_map('trim', preg_split('/\\r\\n|\\r|\\n/', $line ?? '')))); } /** * Configure the "call to action" button. * * @param string $text * @param string $url * @return $this */ public function action($text, $url) { $this->actionText = $text; $this->actionUrl = $url; return $this; } /** * Set the name of the mailer that should send the notification. * * @param string $mailer * @return $this */ public function mailer($mailer) { $this->mailer = $mailer; return $this; } /** * Get an array representation of the message. * * @return array */ public function toArray() { return [ 'level' => $this->level, 'subject' => $this->subject, 'greeting' => $this->greeting, 'salutation' => $this->salutation, 'introLines' => $this->introLines, 'outroLines' => $this->outroLines, 'actionText' => $this->actionText, 'actionUrl' => $this->actionUrl, 'displayableActionUrl' => str_replace(['mailto:', 'tel:'], '', $this->actionUrl ?? ''), ]; } } PKO$W]‹Ç=••9src/Illuminate/Notifications/Messages/DatabaseMessage.phpnu„[µü¤data = $data; } } PKO$W]4Dánn:src/Illuminate/Notifications/Messages/BroadcastMessage.phpnu„[µü¤data = $data; } /** * Set the message data. * * @param array $data * @return $this */ public function data($data) { $this->data = $data; return $this; } } PKO$W] 0Ÿ88%src/Illuminate/Pipeline/composer.jsonnu„[µü¤{ "name": "illuminate/pipeline", "description": "The Illuminate Pipeline package.", "license": "MIT", "homepage": "https://laravel.com", "support": { "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, "authors": [ { "name": "Taylor Otwell", "email": "taylor@laravel.com" } ], "require": { "php": "^8.1", "illuminate/contracts": "^10.0", "illuminate/support": "^10.0" }, "autoload": { "psr-4": { "Illuminate\\Pipeline\\": "" } }, "extra": { "branch-alias": { "dev-master": "10.x-dev" } }, "config": { "sort-packages": true }, "minimum-stability": "dev" } PKO$W]ëαö33"src/Illuminate/Pipeline/LICENSE.mdnu„[µü¤The MIT License (MIT) Copyright (c) Taylor Otwell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PKO$W]úìÙ DDsrc/Illuminate/Pipeline/Hub.phpnu„[µü¤container = $container; } /** * Define the default named pipeline. * * @param \Closure $callback * @return void */ public function defaults(Closure $callback) { return $this->pipeline('default', $callback); } /** * Define a new named pipeline. * * @param string $name * @param \Closure $callback * @return void */ public function pipeline($name, Closure $callback) { $this->pipelines[$name] = $callback; } /** * Send an object through one of the available pipelines. * * @param mixed $object * @param string|null $pipeline * @return mixed */ public function pipe($object, $pipeline = null) { $pipeline = $pipeline ?: 'default'; return call_user_func( $this->pipelines[$pipeline], new Pipeline($this->container), $object ); } /** * Get the container instance used by the hub. * * @return \Illuminate\Contracts\Container\Container */ public function getContainer() { return $this->container; } /** * Set the container instance used by the hub. * * @param \Illuminate\Contracts\Container\Container $container * @return $this */ public function setContainer(Container $container) { $this->container = $container; return $this; } } PKO$W]À– ¾..3src/Illuminate/Pipeline/PipelineServiceProvider.phpnu„[µü¤app->singleton( PipelineHubContract::class, Hub::class ); $this->app->bind('pipeline', fn ($app) => new Pipeline($app)); } /** * Get the services provided by the provider. * * @return array */ public function provides() { return [ PipelineHubContract::class, 'pipeline', ]; } } PKO$W]¦8w¶&&$src/Illuminate/Pipeline/Pipeline.phpnu„[µü¤container = $container; } /** * Set the object being sent through the pipeline. * * @param mixed $passable * @return $this */ public function send($passable) { $this->passable = $passable; return $this; } /** * Set the array of pipes. * * @param array|mixed $pipes * @return $this */ public function through($pipes) { $this->pipes = is_array($pipes) ? $pipes : func_get_args(); return $this; } /** * Push additional pipes onto the pipeline. * * @param array|mixed $pipes * @return $this */ public function pipe($pipes) { array_push($this->pipes, ...(is_array($pipes) ? $pipes : func_get_args())); return $this; } /** * Set the method to call on the pipes. * * @param string $method * @return $this */ public function via($method) { $this->method = $method; return $this; } /** * Run the pipeline with a final destination callback. * * @param \Closure $destination * @return mixed */ public function then(Closure $destination) { $pipeline = array_reduce( array_reverse($this->pipes()), $this->carry(), $this->prepareDestination($destination) ); return $pipeline($this->passable); } /** * Run the pipeline and return the result. * * @return mixed */ public function thenReturn() { return $this->then(function ($passable) { return $passable; }); } /** * Get the final piece of the Closure onion. * * @param \Closure $destination * @return \Closure */ protected function prepareDestination(Closure $destination) { return function ($passable) use ($destination) { try { return $destination($passable); } catch (Throwable $e) { return $this->handleException($passable, $e); } }; } /** * Get a Closure that represents a slice of the application onion. * * @return \Closure */ protected function carry() { return function ($stack, $pipe) { return function ($passable) use ($stack, $pipe) { try { if (is_callable($pipe)) { // If the pipe is a callable, then we will call it directly, but otherwise we // will resolve the pipes out of the dependency container and call it with // the appropriate method and arguments, returning the results back out. return $pipe($passable, $stack); } elseif (! is_object($pipe)) { [$name, $parameters] = $this->parsePipeString($pipe); // If the pipe is a string we will parse the string and resolve the class out // of the dependency injection container. We can then build a callable and // execute the pipe function giving in the parameters that are required. $pipe = $this->getContainer()->make($name); $parameters = array_merge([$passable, $stack], $parameters); } else { // If the pipe is already an object we'll just make a callable and pass it to // the pipe as-is. There is no need to do any extra parsing and formatting // since the object we're given was already a fully instantiated object. $parameters = [$passable, $stack]; } $carry = method_exists($pipe, $this->method) ? $pipe->{$this->method}(...$parameters) : $pipe(...$parameters); return $this->handleCarry($carry); } catch (Throwable $e) { return $this->handleException($passable, $e); } }; }; } /** * Parse full pipe string to get name and parameters. * * @param string $pipe * @return array */ protected function parsePipeString($pipe) { [$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []); if (is_string($parameters)) { $parameters = explode(',', $parameters); } return [$name, $parameters]; } /** * Get the array of configured pipes. * * @return array */ protected function pipes() { return $this->pipes; } /** * Get the container instance. * * @return \Illuminate\Contracts\Container\Container * * @throws \RuntimeException */ protected function getContainer() { if (! $this->container) { throw new RuntimeException('A container instance has not been passed to the Pipeline.'); } return $this->container; } /** * Set the container instance. * * @param \Illuminate\Contracts\Container\Container $container * @return $this */ public function setContainer(Container $container) { $this->container = $container; return $this; } /** * Handle the value returned from each pipe before passing it to the next. * * @param mixed $carry * @return mixed */ protected function handleCarry($carry) { return $carry; } /** * Handle the given exception. * * @param mixed $passable * @param \Throwable $e * @return mixed * * @throws \Throwable */ protected function handleException($passable, Throwable $e) { throw $e; } } PKO$W]oµsÏò ò 3src/Illuminate/Auth/Notifications/ResetPassword.phpnu„[µü¤token = $token; } /** * Get the notification's channels. * * @param mixed $notifiable * @return array|string */ public function via($notifiable) { return ['mail']; } /** * Build the mail representation of the notification. * * @param mixed $notifiable * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { if (static::$toMailCallback) { return call_user_func(static::$toMailCallback, $notifiable, $this->token); } return $this->buildMailMessage($this->resetUrl($notifiable)); } /** * Get the reset password notification mail message for the given URL. * * @param string $url * @return \Illuminate\Notifications\Messages\MailMessage */ protected function buildMailMessage($url) { return (new MailMessage) ->subject(Lang::get('Reset Password Notification')) ->line(Lang::get('You are receiving this email because we received a password reset request for your account.')) ->action(Lang::get('Reset Password'), $url) ->line(Lang::get('This password reset link will expire in :count minutes.', ['count' => config('auth.passwords.'.config('auth.defaults.passwords').'.expire')])) ->line(Lang::get('If you did not request a password reset, no further action is required.')); } /** * Get the reset URL for the given notifiable. * * @param mixed $notifiable * @return string */ protected function resetUrl($notifiable) { if (static::$createUrlCallback) { return call_user_func(static::$createUrlCallback, $notifiable, $this->token); } return url(route('password.reset', [ 'token' => $this->token, 'email' => $notifiable->getEmailForPasswordReset(), ], false)); } /** * Set a callback that should be used when creating the reset password button URL. * * @param \Closure(mixed, string): string $callback * @return void */ public static function createUrlUsing($callback) { static::$createUrlCallback = $callback; } /** * Set a callback that should be used when building the notification mail message. * * @param \Closure(mixed, string): (\Illuminate\Notifications\Messages\MailMessage|\Illuminate\Contracts\Mail\Mailable) $callback * @return void */ public static function toMailUsing($callback) { static::$toMailCallback = $callback; } } PKO$W]1¦»23 3 1src/Illuminate/Auth/Notifications/VerifyEmail.phpnu„[µü¤verificationUrl($notifiable); if (static::$toMailCallback) { return call_user_func(static::$toMailCallback, $notifiable, $verificationUrl); } return $this->buildMailMessage($verificationUrl); } /** * Get the verify email notification mail message for the given URL. * * @param string $url * @return \Illuminate\Notifications\Messages\MailMessage */ protected function buildMailMessage($url) { return (new MailMessage) ->subject(Lang::get('Verify Email Address')) ->line(Lang::get('Please click the button below to verify your email address.')) ->action(Lang::get('Verify Email Address'), $url) ->line(Lang::get('If you did not create an account, no further action is required.')); } /** * Get the verification URL for the given notifiable. * * @param mixed $notifiable * @return string */ protected function verificationUrl($notifiable) { if (static::$createUrlCallback) { return call_user_func(static::$createUrlCallback, $notifiable); } return URL::temporarySignedRoute( 'verification.verify', Carbon::now()->addMinutes(Config::get('auth.verification.expire', 60)), [ 'id' => $notifiable->getKey(), 'hash' => sha1($notifiable->getEmailForVerification()), ] ); } /** * Set a callback that should be used when creating the email verification URL. * * @param \Closure $callback * @return void */ public static function createUrlUsing($callback) { static::$createUrlCallback = $callback; } /** * Set a callback that should be used when building the notification mail message. * * @param \Closure $callback * @return void */ public static function toMailUsing($callback) { static::$toMailCallback = $callback; } } PKO$W]*D³o& & +src/Illuminate/Auth/AuthServiceProvider.phpnu„[µü¤registerAuthenticator(); $this->registerUserResolver(); $this->registerAccessGate(); $this->registerRequirePassword(); $this->registerRequestRebindHandler(); $this->registerEventRebindHandler(); } /** * Register the authenticator services. * * @return void */ protected function registerAuthenticator() { $this->app->singleton('auth', fn ($app) => new AuthManager($app)); $this->app->singleton('auth.driver', fn ($app) => $app['auth']->guard()); } /** * Register a resolver for the authenticated user. * * @return void */ protected function registerUserResolver() { $this->app->bind(AuthenticatableContract::class, fn ($app) => call_user_func($app['auth']->userResolver())); } /** * Register the access gate service. * * @return void */ protected function registerAccessGate() { $this->app->singleton(GateContract::class, function ($app) { return new Gate($app, fn () => call_user_func($app['auth']->userResolver())); }); } /** * Register a resolver for the authenticated user. * * @return void */ protected function registerRequirePassword() { $this->app->bind(RequirePassword::class, function ($app) { return new RequirePassword( $app[ResponseFactory::class], $app[UrlGenerator::class], $app['config']->get('auth.password_timeout') ); }); } /** * Handle the re-binding of the request binding. * * @return void */ protected function registerRequestRebindHandler() { $this->app->rebinding('request', function ($app, $request) { $request->setUserResolver(function ($guard = null) use ($app) { return call_user_func($app['auth']->userResolver(), $guard); }); }); } /** * Handle the re-binding of the event dispatcher binding. * * @return void */ protected function registerEventRebindHandler() { $this->app->rebinding('events', function ($app, $dispatcher) { if (! $app->resolved('auth') || $app['auth']->hasResolvedGuards() === false) { return; } if (method_exists($guard = $app['auth']->guard(), 'setDispatcher')) { $guard->setDispatcher($dispatcher); } }); } } PKO$W]JÄøJJ/src/Illuminate/Auth/AuthenticationException.phpnu„[µü¤guards = $guards; $this->redirectTo = $redirectTo; } /** * Get the guards that were checked. * * @return array */ public function guards() { return $this->guards; } /** * Get the path the user should be redirected to. * * @return string|null */ public function redirectTo() { return $this->redirectTo; } } PKO$W]E*^ KK$src/Illuminate/Auth/RequestGuard.phpnu„[µü¤request = $request; $this->callback = $callback; $this->provider = $provider; } /** * Get the currently authenticated user. * * @return \Illuminate\Contracts\Auth\Authenticatable|null */ public function user() { // If we've already retrieved the user for the current request we can just // return it back immediately. We do not want to fetch the user data on // every call to this method because that would be tremendously slow. if (! is_null($this->user)) { return $this->user; } return $this->user = call_user_func( $this->callback, $this->request, $this->getProvider() ); } /** * Validate a user's credentials. * * @param array $credentials * @return bool */ public function validate(array $credentials = []) { return ! is_null((new static( $this->callback, $credentials['request'], $this->getProvider() ))->user()); } /** * Set the current request instance. * * @param \Illuminate\Http\Request $request * @return $this */ public function setRequest(Request $request) { $this->request = $request; return $this; } } PKO$W]Ge¡.ª ª ,src/Illuminate/Auth/CreatesUserProviders.phpnu„[µü¤getProviderConfiguration($provider))) { return; } if (isset($this->customProviderCreators[$driver = ($config['driver'] ?? null)])) { return call_user_func( $this->customProviderCreators[$driver], $this->app, $config ); } return match ($driver) { 'database' => $this->createDatabaseProvider($config), 'eloquent' => $this->createEloquentProvider($config), default => throw new InvalidArgumentException( "Authentication user provider [{$driver}] is not defined." ), }; } /** * Get the user provider configuration. * * @param string|null $provider * @return array|null */ protected function getProviderConfiguration($provider) { if ($provider = $provider ?: $this->getDefaultUserProvider()) { return $this->app['config']['auth.providers.'.$provider]; } } /** * Create an instance of the database user provider. * * @param array $config * @return \Illuminate\Auth\DatabaseUserProvider */ protected function createDatabaseProvider($config) { $connection = $this->app['db']->connection($config['connection'] ?? null); return new DatabaseUserProvider($connection, $this->app['hash'], $config['table']); } /** * Create an instance of the Eloquent user provider. * * @param array $config * @return \Illuminate\Auth\EloquentUserProvider */ protected function createEloquentProvider($config) { return new EloquentUserProvider($this->app['hash'], $config['model']); } /** * Get the default user provider name. * * @return string */ public function getDefaultUserProvider() { return $this->app['config']['auth.defaults.provider']; } } PKO$W]H�¤Oòò>src/Illuminate/Auth/Passwords/PasswordResetServiceProvider.phpnu„[µü¤registerPasswordBroker(); } /** * Register the password broker instance. * * @return void */ protected function registerPasswordBroker() { $this->app->singleton('auth.password', function ($app) { return new PasswordBrokerManager($app); }); $this->app->bind('auth.password.broker', function ($app) { return $app->make('auth.password')->broker(); }); } /** * Get the services provided by the provider. * * @return array */ public function provides() { return ['auth.password', 'auth.password.broker']; } } PKO$W]KVp—__7src/Illuminate/Auth/Passwords/PasswordBrokerManager.phpnu„[µü¤app = $app; } /** * Attempt to get the broker from the local cache. * * @param string|null $name * @return \Illuminate\Contracts\Auth\PasswordBroker */ public function broker($name = null) { $name = $name ?: $this->getDefaultDriver(); return $this->brokers[$name] ?? ($this->brokers[$name] = $this->resolve($name)); } /** * Resolve the given broker. * * @param string $name * @return \Illuminate\Contracts\Auth\PasswordBroker * * @throws \InvalidArgumentException */ protected function resolve($name) { $config = $this->getConfig($name); if (is_null($config)) { throw new InvalidArgumentException("Password resetter [{$name}] is not defined."); } // The password broker uses a token repository to validate tokens and send user // password e-mails, as well as validating that password reset process as an // aggregate service of sorts providing a convenient interface for resets. return new PasswordBroker( $this->createTokenRepository($config), $this->app['auth']->createUserProvider($config['provider'] ?? null) ); } /** * Create a token repository instance based on the given configuration. * * @param array $config * @return \Illuminate\Auth\Passwords\TokenRepositoryInterface */ protected function createTokenRepository(array $config) { $key = $this->app['config']['app.key']; if (str_starts_with($key, 'base64:')) { $key = base64_decode(substr($key, 7)); } $connection = $config['connection'] ?? null; return new DatabaseTokenRepository( $this->app['db']->connection($connection), $this->app['hash'], $config['table'], $key, $config['expire'], $config['throttle'] ?? 0 ); } /** * Get the password broker configuration. * * @param string $name * @return array|null */ protected function getConfig($name) { return $this->app['config']["auth.passwords.{$name}"]; } /** * Get the default password broker name. * * @return string */ public function getDefaultDriver() { return $this->app['config']['auth.defaults.passwords']; } /** * Set the default password broker name. * * @param string $name * @return void */ public function setDefaultDriver($name) { $this->app['config']['auth.defaults.passwords'] = $name; } /** * Dynamically call the default driver instance. * * @param string $method * @param array $parameters * @return mixed */ public function __call($method, $parameters) { return $this->broker()->{$method}(...$parameters); } } PKO$W]O\È÷ZZ2src/Illuminate/Auth/Passwords/CanResetPassword.phpnu„[µü¤email; } /** * Send the password reset notification. * * @param string $token * @return void */ public function sendPasswordResetNotification($token) { $this->notify(new ResetPasswordNotification($token)); } } PKO$W]Ò�imÙÙ0src/Illuminate/Auth/Passwords/PasswordBroker.phpnu„[µü¤users = $users; $this->tokens = $tokens; } /** * Send a password reset link to a user. * * @param array $credentials * @param \Closure|null $callback * @return string */ public function sendResetLink(array $credentials, ?Closure $callback = null) { // First we will check to see if we found a user at the given credentials and // if we did not we will redirect back to this current URI with a piece of // "flash" data in the session to indicate to the developers the errors. $user = $this->getUser($credentials); if (is_null($user)) { return static::INVALID_USER; } if ($this->tokens->recentlyCreatedToken($user)) { return static::RESET_THROTTLED; } $token = $this->tokens->create($user); if ($callback) { return $callback($user, $token) ?? static::RESET_LINK_SENT; } // Once we have the reset token, we are ready to send the message out to this // user with a link to reset their password. We will then redirect back to // the current URI having nothing set in the session to indicate errors. $user->sendPasswordResetNotification($token); return static::RESET_LINK_SENT; } /** * Reset the password for the given token. * * @param array $credentials * @param \Closure $callback * @return mixed */ public function reset(array $credentials, Closure $callback) { $user = $this->validateReset($credentials); // If the responses from the validate method is not a user instance, we will // assume that it is a redirect and simply return it from this method and // the user is properly redirected having an error message on the post. if (! $user instanceof CanResetPasswordContract) { return $user; } $password = $credentials['password']; // Once the reset has been validated, we'll call the given callback with the // new password. This gives the user an opportunity to store the password // in their persistent storage. Then we'll delete the token and return. $callback($user, $password); $this->tokens->delete($user); return static::PASSWORD_RESET; } /** * Validate a password reset for the given credentials. * * @param array $credentials * @return \Illuminate\Contracts\Auth\CanResetPassword|string */ protected function validateReset(array $credentials) { if (is_null($user = $this->getUser($credentials))) { return static::INVALID_USER; } if (! $this->tokens->exists($user, $credentials['token'])) { return static::INVALID_TOKEN; } return $user; } /** * Get the user for the given credentials. * * @param array $credentials * @return \Illuminate\Contracts\Auth\CanResetPassword|null * * @throws \UnexpectedValueException */ public function getUser(array $credentials) { $credentials = Arr::except($credentials, ['token']); $user = $this->users->retrieveByCredentials($credentials); if ($user && ! $user instanceof CanResetPasswordContract) { throw new UnexpectedValueException('User must implement CanResetPassword interface.'); } return $user; } /** * Create a new password reset token for the given user. * * @param \Illuminate\Contracts\Auth\CanResetPassword $user * @return string */ public function createToken(CanResetPasswordContract $user) { return $this->tokens->create($user); } /** * Delete password reset tokens of the given user. * * @param \Illuminate\Contracts\Auth\CanResetPassword $user * @return void */ public function deleteToken(CanResetPasswordContract $user) { $this->tokens->delete($user); } /** * Validate the given password reset token. * * @param \Illuminate\Contracts\Auth\CanResetPassword $user * @param string $token * @return bool */ public function tokenExists(CanResetPasswordContract $user, $token) { return $this->tokens->exists($user, $token); } /** * Get the password reset token repository implementation. * * @return \Illuminate\Auth\Passwords\TokenRepositoryInterface */ public function getRepository() { return $this->tokens; } } PKO$W]UxÖ2ªª:src/Illuminate/Auth/Passwords/TokenRepositoryInterface.phpnu„[µü¤table = $table; $this->hasher = $hasher; $this->hashKey = $hashKey; $this->expires = $expires * 60; $this->connection = $connection; $this->throttle = $throttle; } /** * Create a new token record. * * @param \Illuminate\Contracts\Auth\CanResetPassword $user * @return string */ public function create(CanResetPasswordContract $user) { $email = $user->getEmailForPasswordReset(); $this->deleteExisting($user); // We will create a new, random token for the user so that we can e-mail them // a safe link to the password reset form. Then we will insert a record in // the database so that we can verify the token within the actual reset. $token = $this->createNewToken(); $this->getTable()->insert($this->getPayload($email, $token)); return $token; } /** * Delete all existing reset tokens from the database. * * @param \Illuminate\Contracts\Auth\CanResetPassword $user * @return int */ protected function deleteExisting(CanResetPasswordContract $user) { return $this->getTable()->where('email', $user->getEmailForPasswordReset())->delete(); } /** * Build the record payload for the table. * * @param string $email * @param string $token * @return array */ protected function getPayload($email, $token) { return ['email' => $email, 'token' => $this->hasher->make($token), 'created_at' => new Carbon]; } /** * Determine if a token record exists and is valid. * * @param \Illuminate\Contracts\Auth\CanResetPassword $user * @param string $token * @return bool */ public function exists(CanResetPasswordContract $user, $token) { $record = (array) $this->getTable()->where( 'email', $user->getEmailForPasswordReset() )->first(); return $record && ! $this->tokenExpired($record['created_at']) && $this->hasher->check($token, $record['token']); } /** * Determine if the token has expired. * * @param string $createdAt * @return bool */ protected function tokenExpired($createdAt) { return Carbon::parse($createdAt)->addSeconds($this->expires)->isPast(); } /** * Determine if the given user recently created a password reset token. * * @param \Illuminate\Contracts\Auth\CanResetPassword $user * @return bool */ public function recentlyCreatedToken(CanResetPasswordContract $user) { $record = (array) $this->getTable()->where( 'email', $user->getEmailForPasswordReset() )->first(); return $record && $this->tokenRecentlyCreated($record['created_at']); } /** * Determine if the token was recently created. * * @param string $createdAt * @return bool */ protected function tokenRecentlyCreated($createdAt) { if ($this->throttle <= 0) { return false; } return Carbon::parse($createdAt)->addSeconds( $this->throttle )->isFuture(); } /** * Delete a token record by user. * * @param \Illuminate\Contracts\Auth\CanResetPassword $user * @return void */ public function delete(CanResetPasswordContract $user) { $this->deleteExisting($user); } /** * Delete expired tokens. * * @return void */ public function deleteExpired() { $expiredAt = Carbon::now()->subSeconds($this->expires); $this->getTable()->where('created_at', '<', $expiredAt)->delete(); } /** * Create a new token for the user. * * @return string */ public function createNewToken() { return hash_hmac('sha256', Str::random(40), $this->hashKey); } /** * Get the database connection instance. * * @return \Illuminate\Database\ConnectionInterface */ public function getConnection() { return $this->connection; } /** * Begin a new database query against the table. * * @return \Illuminate\Database\Query\Builder */ protected function getTable() { return $this->connection->table($this->table); } /** * Get the hasher instance. * * @return \Illuminate\Contracts\Hashing\Hasher */ public function getHasher() { return $this->hasher; } } PKO$W]I¹þ3ìiìi$src/Illuminate/Auth/SessionGuard.phpnu„[µü¤name = $name; $this->session = $session; $this->request = $request; $this->provider = $provider; $this->timebox = $timebox ?: new Timebox; } /** * Get the currently authenticated user. * * @return \Illuminate\Contracts\Auth\Authenticatable|null */ public function user() { if ($this->loggedOut) { return; } // If we've already retrieved the user for the current request we can just // return it back immediately. We do not want to fetch the user data on // every call to this method because that would be tremendously slow. if (! is_null($this->user)) { return $this->user; } $id = $this->session->get($this->getName()); // First we will try to load the user using the identifier in the session if // one exists. Otherwise we will check for a "remember me" cookie in this // request, and if one exists, attempt to retrieve the user using that. if (! is_null($id) && $this->user = $this->provider->retrieveById($id)) { $this->fireAuthenticatedEvent($this->user); } // If the user is null, but we decrypt a "recaller" cookie we can attempt to // pull the user data on that cookie which serves as a remember cookie on // the application. Once we have a user we can return it to the caller. if (is_null($this->user) && ! is_null($recaller = $this->recaller())) { $this->user = $this->userFromRecaller($recaller); if ($this->user) { $this->updateSession($this->user->getAuthIdentifier()); $this->fireLoginEvent($this->user, true); } } return $this->user; } /** * Pull a user from the repository by its "remember me" cookie token. * * @param \Illuminate\Auth\Recaller $recaller * @return mixed */ protected function userFromRecaller($recaller) { if (! $recaller->valid() || $this->recallAttempted) { return; } // If the user is null, but we decrypt a "recaller" cookie we can attempt to // pull the user data on that cookie which serves as a remember cookie on // the application. Once we have a user we can return it to the caller. $this->recallAttempted = true; $this->viaRemember = ! is_null($user = $this->provider->retrieveByToken( $recaller->id(), $recaller->token() )); return $user; } /** * Get the decrypted recaller cookie for the request. * * @return \Illuminate\Auth\Recaller|null */ protected function recaller() { if (is_null($this->request)) { return; } if ($recaller = $this->request->cookies->get($this->getRecallerName())) { return new Recaller($recaller); } } /** * Get the ID for the currently authenticated user. * * @return int|string|null */ public function id() { if ($this->loggedOut) { return; } return $this->user() ? $this->user()->getAuthIdentifier() : $this->session->get($this->getName()); } /** * Log a user into the application without sessions or cookies. * * @param array $credentials * @return bool */ public function once(array $credentials = []) { $this->fireAttemptEvent($credentials); if ($this->validate($credentials)) { $this->setUser($this->lastAttempted); return true; } return false; } /** * Log the given user ID into the application without sessions or cookies. * * @param mixed $id * @return \Illuminate\Contracts\Auth\Authenticatable|false */ public function onceUsingId($id) { if (! is_null($user = $this->provider->retrieveById($id))) { $this->setUser($user); return $user; } return false; } /** * Validate a user's credentials. * * @param array $credentials * @return bool */ public function validate(array $credentials = []) { $this->lastAttempted = $user = $this->provider->retrieveByCredentials($credentials); return $this->hasValidCredentials($user, $credentials); } /** * Attempt to authenticate using HTTP Basic Auth. * * @param string $field * @param array $extraConditions * @return \Symfony\Component\HttpFoundation\Response|null * * @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException */ public function basic($field = 'email', $extraConditions = []) { if ($this->check()) { return; } // If a username is set on the HTTP basic request, we will return out without // interrupting the request lifecycle. Otherwise, we'll need to generate a // request indicating that the given credentials were invalid for login. if ($this->attemptBasic($this->getRequest(), $field, $extraConditions)) { return; } return $this->failedBasicResponse(); } /** * Perform a stateless HTTP Basic login attempt. * * @param string $field * @param array $extraConditions * @return \Symfony\Component\HttpFoundation\Response|null * * @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException */ public function onceBasic($field = 'email', $extraConditions = []) { $credentials = $this->basicCredentials($this->getRequest(), $field); if (! $this->once(array_merge($credentials, $extraConditions))) { return $this->failedBasicResponse(); } } /** * Attempt to authenticate using basic authentication. * * @param \Symfony\Component\HttpFoundation\Request $request * @param string $field * @param array $extraConditions * @return bool */ protected function attemptBasic(Request $request, $field, $extraConditions = []) { if (! $request->getUser()) { return false; } return $this->attempt(array_merge( $this->basicCredentials($request, $field), $extraConditions )); } /** * Get the credential array for an HTTP Basic request. * * @param \Symfony\Component\HttpFoundation\Request $request * @param string $field * @return array */ protected function basicCredentials(Request $request, $field) { return [$field => $request->getUser(), 'password' => $request->getPassword()]; } /** * Get the response for basic authentication. * * @return void * * @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException */ protected function failedBasicResponse() { throw new UnauthorizedHttpException('Basic', 'Invalid credentials.'); } /** * Attempt to authenticate a user using the given credentials. * * @param array $credentials * @param bool $remember * @return bool */ public function attempt(array $credentials = [], $remember = false) { $this->fireAttemptEvent($credentials, $remember); $this->lastAttempted = $user = $this->provider->retrieveByCredentials($credentials); // If an implementation of UserInterface was returned, we'll ask the provider // to validate the user against the given credentials, and if they are in // fact valid we'll log the users into the application and return true. if ($this->hasValidCredentials($user, $credentials)) { $this->login($user, $remember); return true; } // If the authentication attempt fails we will fire an event so that the user // may be notified of any suspicious attempts to access their account from // an unrecognized user. A developer may listen to this event as needed. $this->fireFailedEvent($user, $credentials); return false; } /** * Attempt to authenticate a user with credentials and additional callbacks. * * @param array $credentials * @param array|callable|null $callbacks * @param bool $remember * @return bool */ public function attemptWhen(array $credentials = [], $callbacks = null, $remember = false) { $this->fireAttemptEvent($credentials, $remember); $this->lastAttempted = $user = $this->provider->retrieveByCredentials($credentials); // This method does the exact same thing as attempt, but also executes callbacks after // the user is retrieved and validated. If one of the callbacks returns falsy we do // not login the user. Instead, we will fail the specific authentication attempt. if ($this->hasValidCredentials($user, $credentials) && $this->shouldLogin($callbacks, $user)) { $this->login($user, $remember); return true; } $this->fireFailedEvent($user, $credentials); return false; } /** * Determine if the user matches the credentials. * * @param mixed $user * @param array $credentials * @return bool */ protected function hasValidCredentials($user, $credentials) { return $this->timebox->call(function ($timebox) use ($user, $credentials) { $validated = ! is_null($user) && $this->provider->validateCredentials($user, $credentials); if ($validated) { $timebox->returnEarly(); $this->fireValidatedEvent($user); } return $validated; }, 200 * 1000); } /** * Determine if the user should login by executing the given callbacks. * * @param array|callable|null $callbacks * @param \Illuminate\Contracts\Auth\Authenticatable $user * @return bool */ protected function shouldLogin($callbacks, AuthenticatableContract $user) { foreach (Arr::wrap($callbacks) as $callback) { if (! $callback($user, $this)) { return false; } } return true; } /** * Log the given user ID into the application. * * @param mixed $id * @param bool $remember * @return \Illuminate\Contracts\Auth\Authenticatable|false */ public function loginUsingId($id, $remember = false) { if (! is_null($user = $this->provider->retrieveById($id))) { $this->login($user, $remember); return $user; } return false; } /** * Log a user into the application. * * @param \Illuminate\Contracts\Auth\Authenticatable $user * @param bool $remember * @return void */ public function login(AuthenticatableContract $user, $remember = false) { $this->updateSession($user->getAuthIdentifier()); // If the user should be permanently "remembered" by the application we will // queue a permanent cookie that contains the encrypted copy of the user // identifier. We will then decrypt this later to retrieve the users. if ($remember) { $this->ensureRememberTokenIsSet($user); $this->queueRecallerCookie($user); } // If we have an event dispatcher instance set we will fire an event so that // any listeners will hook into the authentication events and run actions // based on the login and logout events fired from the guard instances. $this->fireLoginEvent($user, $remember); $this->setUser($user); } /** * Update the session with the given ID. * * @param string $id * @return void */ protected function updateSession($id) { $this->session->put($this->getName(), $id); $this->session->migrate(true); } /** * Create a new "remember me" token for the user if one doesn't already exist. * * @param \Illuminate\Contracts\Auth\Authenticatable $user * @return void */ protected function ensureRememberTokenIsSet(AuthenticatableContract $user) { if (empty($user->getRememberToken())) { $this->cycleRememberToken($user); } } /** * Queue the recaller cookie into the cookie jar. * * @param \Illuminate\Contracts\Auth\Authenticatable $user * @return void */ protected function queueRecallerCookie(AuthenticatableContract $user) { $this->getCookieJar()->queue($this->createRecaller( $user->getAuthIdentifier().'|'.$user->getRememberToken().'|'.$user->getAuthPassword() )); } /** * Create a "remember me" cookie for a given ID. * * @param string $value * @return \Symfony\Component\HttpFoundation\Cookie */ protected function createRecaller($value) { return $this->getCookieJar()->make($this->getRecallerName(), $value, $this->getRememberDuration()); } /** * Log the user out of the application. * * @return void */ public function logout() { $user = $this->user(); $this->clearUserDataFromStorage(); if (! is_null($this->user) && ! empty($user->getRememberToken())) { $this->cycleRememberToken($user); } // If we have an event dispatcher instance, we can fire off the logout event // so any further processing can be done. This allows the developer to be // listening for anytime a user signs out of this application manually. if (isset($this->events)) { $this->events->dispatch(new Logout($this->name, $user)); } // Once we have fired the logout event we will clear the users out of memory // so they are no longer available as the user is no longer considered as // being signed into this application and should not be available here. $this->user = null; $this->loggedOut = true; } /** * Log the user out of the application on their current device only. * * This method does not cycle the "remember" token. * * @return void */ public function logoutCurrentDevice() { $user = $this->user(); $this->clearUserDataFromStorage(); // If we have an event dispatcher instance, we can fire off the logout event // so any further processing can be done. This allows the developer to be // listening for anytime a user signs out of this application manually. if (isset($this->events)) { $this->events->dispatch(new CurrentDeviceLogout($this->name, $user)); } // Once we have fired the logout event we will clear the users out of memory // so they are no longer available as the user is no longer considered as // being signed into this application and should not be available here. $this->user = null; $this->loggedOut = true; } /** * Remove the user data from the session and cookies. * * @return void */ protected function clearUserDataFromStorage() { $this->session->remove($this->getName()); $this->getCookieJar()->unqueue($this->getRecallerName()); if (! is_null($this->recaller())) { $this->getCookieJar()->queue( $this->getCookieJar()->forget($this->getRecallerName()) ); } } /** * Refresh the "remember me" token for the user. * * @param \Illuminate\Contracts\Auth\Authenticatable $user * @return void */ protected function cycleRememberToken(AuthenticatableContract $user) { $user->setRememberToken($token = Str::random(60)); $this->provider->updateRememberToken($user, $token); } /** * Invalidate other sessions for the current user. * * The application must be using the AuthenticateSession middleware. * * @param string $password * @param string $attribute * @return \Illuminate\Contracts\Auth\Authenticatable|null * * @throws \Illuminate\Auth\AuthenticationException */ public function logoutOtherDevices($password, $attribute = 'password') { if (! $this->user()) { return; } $result = $this->rehashUserPassword($password, $attribute); if ($this->recaller() || $this->getCookieJar()->hasQueued($this->getRecallerName())) { $this->queueRecallerCookie($this->user()); } $this->fireOtherDeviceLogoutEvent($this->user()); return $result; } /** * Rehash the current user's password. * * @param string $password * @param string $attribute * @return \Illuminate\Contracts\Auth\Authenticatable|null * * @throws \InvalidArgumentException */ protected function rehashUserPassword($password, $attribute) { if (! Hash::check($password, $this->user()->{$attribute})) { throw new InvalidArgumentException('The given password does not match the current password.'); } return tap($this->user()->forceFill([ $attribute => Hash::make($password), ]))->save(); } /** * Register an authentication attempt event listener. * * @param mixed $callback * @return void */ public function attempting($callback) { $this->events?->listen(Events\Attempting::class, $callback); } /** * Fire the attempt event with the arguments. * * @param array $credentials * @param bool $remember * @return void */ protected function fireAttemptEvent(array $credentials, $remember = false) { $this->events?->dispatch(new Attempting($this->name, $credentials, $remember)); } /** * Fires the validated event if the dispatcher is set. * * @param \Illuminate\Contracts\Auth\Authenticatable $user * @return void */ protected function fireValidatedEvent($user) { $this->events?->dispatch(new Validated($this->name, $user)); } /** * Fire the login event if the dispatcher is set. * * @param \Illuminate\Contracts\Auth\Authenticatable $user * @param bool $remember * @return void */ protected function fireLoginEvent($user, $remember = false) { $this->events?->dispatch(new Login($this->name, $user, $remember)); } /** * Fire the authenticated event if the dispatcher is set. * * @param \Illuminate\Contracts\Auth\Authenticatable $user * @return void */ protected function fireAuthenticatedEvent($user) { $this->events?->dispatch(new Authenticated($this->name, $user)); } /** * Fire the other device logout event if the dispatcher is set. * * @param \Illuminate\Contracts\Auth\Authenticatable $user * @return void */ protected function fireOtherDeviceLogoutEvent($user) { $this->events?->dispatch(new OtherDeviceLogout($this->name, $user)); } /** * Fire the failed authentication attempt event with the given arguments. * * @param \Illuminate\Contracts\Auth\Authenticatable|null $user * @param array $credentials * @return void */ protected function fireFailedEvent($user, array $credentials) { $this->events?->dispatch(new Failed($this->name, $user, $credentials)); } /** * Get the last user we attempted to authenticate. * * @return \Illuminate\Contracts\Auth\Authenticatable */ public function getLastAttempted() { return $this->lastAttempted; } /** * Get a unique identifier for the auth session value. * * @return string */ public function getName() { return 'login_'.$this->name.'_'.sha1(static::class); } /** * Get the name of the cookie used to store the "recaller". * * @return string */ public function getRecallerName() { return 'remember_'.$this->name.'_'.sha1(static::class); } /** * Determine if the user was authenticated via "remember me" cookie. * * @return bool */ public function viaRemember() { return $this->viaRemember; } /** * Get the number of minutes the remember me cookie should be valid for. * * @return int */ protected function getRememberDuration() { return $this->rememberDuration; } /** * Set the number of minutes the remember me cookie should be valid for. * * @param int $minutes * @return $this */ public function setRememberDuration($minutes) { $this->rememberDuration = $minutes; return $this; } /** * Get the cookie creator instance used by the guard. * * @return \Illuminate\Contracts\Cookie\QueueingFactory * * @throws \RuntimeException */ public function getCookieJar() { if (! isset($this->cookie)) { throw new RuntimeException('Cookie jar has not been set.'); } return $this->cookie; } /** * Set the cookie creator instance used by the guard. * * @param \Illuminate\Contracts\Cookie\QueueingFactory $cookie * @return void */ public function setCookieJar(CookieJar $cookie) { $this->cookie = $cookie; } /** * Get the event dispatcher instance. * * @return \Illuminate\Contracts\Events\Dispatcher */ public function getDispatcher() { return $this->events; } /** * Set the event dispatcher instance. * * @param \Illuminate\Contracts\Events\Dispatcher $events * @return void */ public function setDispatcher(Dispatcher $events) { $this->events = $events; } /** * Get the session store used by the guard. * * @return \Illuminate\Contracts\Session\Session */ public function getSession() { return $this->session; } /** * Return the currently cached user. * * @return \Illuminate\Contracts\Auth\Authenticatable|null */ public function getUser() { return $this->user; } /** * Set the current user. * * @param \Illuminate\Contracts\Auth\Authenticatable $user * @return $this */ public function setUser(AuthenticatableContract $user) { $this->user = $user; $this->loggedOut = false; $this->fireAuthenticatedEvent($user); return $this; } /** * Get the current request instance. * * @return \Symfony\Component\HttpFoundation\Request */ public function getRequest() { return $this->request ?: Request::createFromGlobals(); } /** * Set the current request instance. * * @param \Symfony\Component\HttpFoundation\Request $request * @return $this */ public function setRequest(Request $request) { $this->request = $request; return $this; } /** * Get the timebox instance used by the guard. * * @return \Illuminate\Support\Timebox */ public function getTimebox() { return $this->timebox; } } PKO$W]Þþ‚¨YY<src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.phpnu„[µü¤auth = $auth; } /** * Specify the guard and field for the middleware. * * @param string|null $guard * @param string|null $field * @return string * * @named-arguments-supported */ public static function using($guard = null, $field = null) { return static::class.':'.implode(',', func_get_args()); } /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string|null $guard * @param string|null $field * @return mixed * * @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException */ public function handle($request, Closure $next, $guard = null, $field = null) { $this->auth->guard($guard)->basic($field ?: 'email'); return $next($request); } } PKO$W]A5“×w w /src/Illuminate/Auth/Middleware/Authenticate.phpnu„[µü¤auth = $auth; } /** * Specify the guards for the middleware. * * @param string $guard * @param string $others * @return string */ public static function using($guard, ...$others) { return static::class.':'.implode(',', [$guard, ...$others]); } /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string[] ...$guards * @return mixed * * @throws \Illuminate\Auth\AuthenticationException */ public function handle($request, Closure $next, ...$guards) { $this->authenticate($request, $guards); return $next($request); } /** * Determine if the user is logged in to any of the given guards. * * @param \Illuminate\Http\Request $request * @param array $guards * @return void * * @throws \Illuminate\Auth\AuthenticationException */ protected function authenticate($request, array $guards) { if (empty($guards)) { $guards = [null]; } foreach ($guards as $guard) { if ($this->auth->guard($guard)->check()) { return $this->auth->shouldUse($guard); } } $this->unauthenticated($request, $guards); } /** * Handle an unauthenticated user. * * @param \Illuminate\Http\Request $request * @param array $guards * @return void * * @throws \Illuminate\Auth\AuthenticationException */ protected function unauthenticated($request, array $guards) { throw new AuthenticationException( 'Unauthenticated.', $guards, $this->redirectTo($request) ); } /** * Get the path the user should be redirected to when they are not authenticated. * * @param \Illuminate\Http\Request $request * @return string|null */ protected function redirectTo(Request $request) { // } } PKO$W]öý弯¯8src/Illuminate/Auth/Middleware/EnsureEmailIsVerified.phpnu„[µü¤user() || ($request->user() instanceof MustVerifyEmail && ! $request->user()->hasVerifiedEmail())) { return $request->expectsJson() ? abort(403, 'Your email address is not verified.') : Redirect::guest(URL::route($redirectToRoute ?: 'verification.notice')); } return $next($request); } } PKO$W] b b ,src/Illuminate/Auth/Middleware/Authorize.phpnu„[µü¤gate = $gate; } /** * Specify the ability and models for the middleware. * * @param string $ability * @param string ...$models * @return string */ public static function using($ability, ...$models) { return static::class.':'.implode(',', [$ability, ...$models]); } /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string $ability * @param array|null ...$models * @return mixed * * @throws \Illuminate\Auth\AuthenticationException * @throws \Illuminate\Auth\Access\AuthorizationException */ public function handle($request, Closure $next, $ability, ...$models) { $this->gate->authorize($ability, $this->getGateArguments($request, $models)); return $next($request); } /** * Get the arguments parameter for the gate. * * @param \Illuminate\Http\Request $request * @param array|null $models * @return \Illuminate\Database\Eloquent\Model|array|string */ protected function getGateArguments($request, $models) { if (is_null($models)) { return []; } return collect($models)->map(function ($model) use ($request) { return $model instanceof Model ? $model : $this->getModel($request, $model); })->all(); } /** * Get the model to authorize. * * @param \Illuminate\Http\Request $request * @param string $model * @return \Illuminate\Database\Eloquent\Model|string */ protected function getModel($request, $model) { if ($this->isClassName($model)) { return trim($model); } return $request->route($model, null) ?? ((preg_match("/^['\"](.*)['\"]$/", trim($model), $matches)) ? $matches[1] : null); } /** * Checks if the given string looks like a fully qualified class name. * * @param string $value * @return bool */ protected function isClassName($value) { return str_contains($value, '\\'); } } PKO$W]ø­~VY Y 2src/Illuminate/Auth/Middleware/RequirePassword.phpnu„[µü¤responseFactory = $responseFactory; $this->urlGenerator = $urlGenerator; $this->passwordTimeout = $passwordTimeout ?: 10800; } /** * Specify the redirect route and timeout for the middleware. * * @param string|null $redirectToRoute * @param string|int|null $passwordTimeoutSeconds * @return string * * @named-arguments-supported */ public static function using($redirectToRoute = null, $passwordTimeoutSeconds = null) { return static::class.':'.implode(',', func_get_args()); } /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string|null $redirectToRoute * @param string|int|null $passwordTimeoutSeconds * @return mixed */ public function handle($request, Closure $next, $redirectToRoute = null, $passwordTimeoutSeconds = null) { if ($this->shouldConfirmPassword($request, $passwordTimeoutSeconds)) { if ($request->expectsJson()) { return $this->responseFactory->json([ 'message' => 'Password confirmation required.', ], 423); } return $this->responseFactory->redirectGuest( $this->urlGenerator->route($redirectToRoute ?: 'password.confirm') ); } return $next($request); } /** * Determine if the confirmation timeout has expired. * * @param \Illuminate\Http\Request $request * @param int|null $passwordTimeoutSeconds * @return bool */ protected function shouldConfirmPassword($request, $passwordTimeoutSeconds = null) { $confirmedAt = time() - $request->session()->get('auth.password_confirmed_at', 0); return $confirmedAt > ($passwordTimeoutSeconds ?? $this->passwordTimeout); } } PKO$W],º4ZCsrc/Illuminate/Auth/Listeners/SendEmailVerificationNotification.phpnu„[µü¤user instanceof MustVerifyEmail && ! $event->user->hasVerifiedEmail()) { $event->user->sendEmailVerificationNotification(); } } } PKO$W] 9ÃVV src/Illuminate/Auth/Recaller.phpnu„[µü¤recaller = @unserialize($recaller, ['allowed_classes' => false]) ?: $recaller; } /** * Get the user ID from the recaller. * * @return string */ public function id() { return explode('|', $this->recaller, 3)[0]; } /** * Get the "remember token" token from the recaller. * * @return string */ public function token() { return explode('|', $this->recaller, 3)[1]; } /** * Get the password from the recaller. * * @return string */ public function hash() { return explode('|', $this->recaller, 4)[2]; } /** * Determine if the recaller is valid. * * @return bool */ public function valid() { return $this->properString() && $this->hasAllSegments(); } /** * Determine if the recaller is an invalid string. * * @return bool */ protected function properString() { return is_string($this->recaller) && str_contains($this->recaller, '|'); } /** * Determine if the recaller has all segments. * * @return bool */ protected function hasAllSegments() { $segments = explode('|', $this->recaller); return count($segments) >= 3 && trim($segments[0]) !== '' && trim($segments[1]) !== ''; } /** * Get the recaller's segments. * * @return array */ public function segments() { return explode('|', $this->recaller); } } PKO$W]NOý躺,src/Illuminate/Auth/EloquentUserProvider.phpnu„[µü¤model = $model; $this->hasher = $hasher; } /** * Retrieve a user by their unique identifier. * * @param mixed $identifier * @return \Illuminate\Contracts\Auth\Authenticatable|null */ public function retrieveById($identifier) { $model = $this->createModel(); return $this->newModelQuery($model) ->where($model->getAuthIdentifierName(), $identifier) ->first(); } /** * Retrieve a user by their unique identifier and "remember me" token. * * @param mixed $identifier * @param string $token * @return \Illuminate\Contracts\Auth\Authenticatable|null */ public function retrieveByToken($identifier, $token) { $model = $this->createModel(); $retrievedModel = $this->newModelQuery($model)->where( $model->getAuthIdentifierName(), $identifier )->first(); if (! $retrievedModel) { return; } $rememberToken = $retrievedModel->getRememberToken(); return $rememberToken && hash_equals($rememberToken, $token) ? $retrievedModel : null; } /** * Update the "remember me" token for the given user in storage. * * @param \Illuminate\Contracts\Auth\Authenticatable $user * @param string $token * @return void */ public function updateRememberToken(UserContract $user, $token) { $user->setRememberToken($token); $timestamps = $user->timestamps; $user->timestamps = false; $user->save(); $user->timestamps = $timestamps; } /** * Retrieve a user by the given credentials. * * @param array $credentials * @return \Illuminate\Contracts\Auth\Authenticatable|null */ public function retrieveByCredentials(array $credentials) { $credentials = array_filter( $credentials, fn ($key) => ! str_contains($key, 'password'), ARRAY_FILTER_USE_KEY ); if (empty($credentials)) { return; } // First we will add each credential element to the query as a where clause. // Then we can execute the query and, if we found a user, return it in a // Eloquent User "model" that will be utilized by the Guard instances. $query = $this->newModelQuery(); foreach ($credentials as $key => $value) { if (is_array($value) || $value instanceof Arrayable) { $query->whereIn($key, $value); } elseif ($value instanceof Closure) { $value($query); } else { $query->where($key, $value); } } return $query->first(); } /** * Validate a user against the given credentials. * * @param \Illuminate\Contracts\Auth\Authenticatable $user * @param array $credentials * @return bool */ public function validateCredentials(UserContract $user, array $credentials) { if (is_null($plain = $credentials['password'])) { return false; } return $this->hasher->check($plain, $user->getAuthPassword()); } /** * Get a new query builder for the model instance. * * @param \Illuminate\Database\Eloquent\Model|null $model * @return \Illuminate\Database\Eloquent\Builder */ protected function newModelQuery($model = null) { $query = is_null($model) ? $this->createModel()->newQuery() : $model->newQuery(); with($query, $this->queryCallback); return $query; } /** * Create a new instance of the model. * * @return \Illuminate\Database\Eloquent\Model */ public function createModel() { $class = '\\'.ltrim($this->model, '\\'); return new $class; } /** * Gets the hasher implementation. * * @return \Illuminate\Contracts\Hashing\Hasher */ public function getHasher() { return $this->hasher; } /** * Sets the hasher implementation. * * @param \Illuminate\Contracts\Hashing\Hasher $hasher * @return $this */ public function setHasher(HasherContract $hasher) { $this->hasher = $hasher; return $this; } /** * Gets the name of the Eloquent user model. * * @return string */ public function getModel() { return $this->model; } /** * Sets the name of the Eloquent user model. * * @param string $model * @return $this */ public function setModel($model) { $this->model = $model; return $this; } /** * Get the callback that modifies the query before retrieving users. * * @return \Closure|null */ public function getQueryCallback() { return $this->queryCallback; } /** * Sets the callback to modify the query before retrieving users. * * @param (\Closure(\Illuminate\Database\Eloquent\Builder):mixed)|null $queryCallback * @return $this */ public function withQuery($queryCallback = null) { $this->queryCallback = $queryCallback; return $this; } } PKO$W]=m/òò!src/Illuminate/Auth/composer.jsonnu„[µü¤{ "name": "illuminate/auth", "description": "The Illuminate Auth package.", "license": "MIT", "homepage": "https://laravel.com", "support": { "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, "authors": [ { "name": "Taylor Otwell", "email": "taylor@laravel.com" } ], "require": { "php": "^8.1", "ext-hash": "*", "illuminate/collections": "^10.0", "illuminate/contracts": "^10.0", "illuminate/http": "^10.0", "illuminate/macroable": "^10.0", "illuminate/queue": "^10.0", "illuminate/support": "^10.0" }, "autoload": { "psr-4": { "Illuminate\\Auth\\": "" } }, "extra": { "branch-alias": { "dev-master": "10.x-dev" } }, "suggest": { "illuminate/console": "Required to use the auth:clear-resets command (^10.0).", "illuminate/queue": "Required to fire login / logout events (^10.0).", "illuminate/session": "Required to use the session based guard (^10.0)." }, "config": { "sort-packages": true }, "minimum-stability": "dev" } PKO$W]ëαö33src/Illuminate/Auth/LICENSE.mdnu„[µü¤The MIT License (MIT) Copyright (c) Taylor Otwell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PKO$W]]‰ˆ¥ì ì $src/Illuminate/Auth/GuardHelpers.phpnu„[µü¤user() ?? throw new AuthenticationException; } /** * Determine if the guard has a user instance. * * @return bool */ public function hasUser() { return ! is_null($this->user); } /** * Determine if the current user is authenticated. * * @return bool */ public function check() { return ! is_null($this->user()); } /** * Determine if the current user is a guest. * * @return bool */ public function guest() { return ! $this->check(); } /** * Get the ID for the currently authenticated user. * * @return int|string|null */ public function id() { if ($this->user()) { return $this->user()->getAuthIdentifier(); } } /** * Set the current user. * * @param \Illuminate\Contracts\Auth\Authenticatable $user * @return $this */ public function setUser(AuthenticatableContract $user) { $this->user = $user; return $this; } /** * Forget the current user. * * @return $this */ public function forgetUser() { $this->user = null; return $this; } /** * Get the user provider used by the guard. * * @return \Illuminate\Contracts\Auth\UserProvider */ public function getProvider() { return $this->provider; } /** * Set the user provider used by the guard. * * @param \Illuminate\Contracts\Auth\UserProvider $provider * @return void */ public function setProvider(UserProvider $provider) { $this->provider = $provider; } } PKO$W]˜YZ3FF3src/Illuminate/Auth/Access/HandlesAuthorization.phpnu„[µü¤policies = $policies; $this->container = $container; $this->abilities = $abilities; $this->userResolver = $userResolver; $this->afterCallbacks = $afterCallbacks; $this->beforeCallbacks = $beforeCallbacks; $this->guessPolicyNamesUsingCallback = $guessPolicyNamesUsingCallback; } /** * Determine if a given ability has been defined. * * @param string|array $ability * @return bool */ public function has($ability) { $abilities = is_array($ability) ? $ability : func_get_args(); foreach ($abilities as $ability) { if (! isset($this->abilities[$ability])) { return false; } } return true; } /** * Perform an on-demand authorization check. Throw an authorization exception if the condition or callback is false. * * @param \Illuminate\Auth\Access\Response|\Closure|bool $condition * @param string|null $message * @param string|null $code * @return \Illuminate\Auth\Access\Response * * @throws \Illuminate\Auth\Access\AuthorizationException */ public function allowIf($condition, $message = null, $code = null) { return $this->authorizeOnDemand($condition, $message, $code, true); } /** * Perform an on-demand authorization check. Throw an authorization exception if the condition or callback is true. * * @param \Illuminate\Auth\Access\Response|\Closure|bool $condition * @param string|null $message * @param string|null $code * @return \Illuminate\Auth\Access\Response * * @throws \Illuminate\Auth\Access\AuthorizationException */ public function denyIf($condition, $message = null, $code = null) { return $this->authorizeOnDemand($condition, $message, $code, false); } /** * Authorize a given condition or callback. * * @param \Illuminate\Auth\Access\Response|\Closure|bool $condition * @param string|null $message * @param string|null $code * @param bool $allowWhenResponseIs * @return \Illuminate\Auth\Access\Response * * @throws \Illuminate\Auth\Access\AuthorizationException */ protected function authorizeOnDemand($condition, $message, $code, $allowWhenResponseIs) { $user = $this->resolveUser(); if ($condition instanceof Closure) { $response = $this->canBeCalledWithUser($user, $condition) ? $condition($user) : new Response(false, $message, $code); } else { $response = $condition; } return with($response instanceof Response ? $response : new Response( (bool) $response === $allowWhenResponseIs, $message, $code ))->authorize(); } /** * Define a new ability. * * @param string $ability * @param callable|array|string $callback * @return $this * * @throws \InvalidArgumentException */ public function define($ability, $callback) { if (is_array($callback) && isset($callback[0]) && is_string($callback[0])) { $callback = $callback[0].'@'.$callback[1]; } if (is_callable($callback)) { $this->abilities[$ability] = $callback; } elseif (is_string($callback)) { $this->stringCallbacks[$ability] = $callback; $this->abilities[$ability] = $this->buildAbilityCallback($ability, $callback); } else { throw new InvalidArgumentException("Callback must be a callable, callback array, or a 'Class@method' string."); } return $this; } /** * Define abilities for a resource. * * @param string $name * @param string $class * @param array|null $abilities * @return $this */ public function resource($name, $class, ?array $abilities = null) { $abilities = $abilities ?: [ 'viewAny' => 'viewAny', 'view' => 'view', 'create' => 'create', 'update' => 'update', 'delete' => 'delete', ]; foreach ($abilities as $ability => $method) { $this->define($name.'.'.$ability, $class.'@'.$method); } return $this; } /** * Create the ability callback for a callback string. * * @param string $ability * @param string $callback * @return \Closure */ protected function buildAbilityCallback($ability, $callback) { return function () use ($ability, $callback) { if (str_contains($callback, '@')) { [$class, $method] = Str::parseCallback($callback); } else { $class = $callback; } $policy = $this->resolvePolicy($class); $arguments = func_get_args(); $user = array_shift($arguments); $result = $this->callPolicyBefore( $policy, $user, $ability, $arguments ); if (! is_null($result)) { return $result; } return isset($method) ? $policy->{$method}(...func_get_args()) : $policy(...func_get_args()); }; } /** * Define a policy class for a given class type. * * @param string $class * @param string $policy * @return $this */ public function policy($class, $policy) { $this->policies[$class] = $policy; return $this; } /** * Register a callback to run before all Gate checks. * * @param callable $callback * @return $this */ public function before(callable $callback) { $this->beforeCallbacks[] = $callback; return $this; } /** * Register a callback to run after all Gate checks. * * @param callable $callback * @return $this */ public function after(callable $callback) { $this->afterCallbacks[] = $callback; return $this; } /** * Determine if all of the given abilities should be granted for the current user. * * @param iterable|string $ability * @param array|mixed $arguments * @return bool */ public function allows($ability, $arguments = []) { return $this->check($ability, $arguments); } /** * Determine if any of the given abilities should be denied for the current user. * * @param iterable|string $ability * @param array|mixed $arguments * @return bool */ public function denies($ability, $arguments = []) { return ! $this->allows($ability, $arguments); } /** * Determine if all of the given abilities should be granted for the current user. * * @param iterable|string $abilities * @param array|mixed $arguments * @return bool */ public function check($abilities, $arguments = []) { return collect($abilities)->every( fn ($ability) => $this->inspect($ability, $arguments)->allowed() ); } /** * Determine if any one of the given abilities should be granted for the current user. * * @param iterable|string $abilities * @param array|mixed $arguments * @return bool */ public function any($abilities, $arguments = []) { return collect($abilities)->contains(fn ($ability) => $this->check($ability, $arguments)); } /** * Determine if all of the given abilities should be denied for the current user. * * @param iterable|string $abilities * @param array|mixed $arguments * @return bool */ public function none($abilities, $arguments = []) { return ! $this->any($abilities, $arguments); } /** * Determine if the given ability should be granted for the current user. * * @param string $ability * @param array|mixed $arguments * @return \Illuminate\Auth\Access\Response * * @throws \Illuminate\Auth\Access\AuthorizationException */ public function authorize($ability, $arguments = []) { return $this->inspect($ability, $arguments)->authorize(); } /** * Inspect the user for the given ability. * * @param string $ability * @param array|mixed $arguments * @return \Illuminate\Auth\Access\Response */ public function inspect($ability, $arguments = []) { try { $result = $this->raw($ability, $arguments); if ($result instanceof Response) { return $result; } return $result ? Response::allow() : ($this->defaultDenialResponse ?? Response::deny()); } catch (AuthorizationException $e) { return $e->toResponse(); } } /** * Get the raw result from the authorization callback. * * @param string $ability * @param array|mixed $arguments * @return mixed * * @throws \Illuminate\Auth\Access\AuthorizationException */ public function raw($ability, $arguments = []) { $arguments = Arr::wrap($arguments); $user = $this->resolveUser(); // First we will call the "before" callbacks for the Gate. If any of these give // back a non-null response, we will immediately return that result in order // to let the developers override all checks for some authorization cases. $result = $this->callBeforeCallbacks( $user, $ability, $arguments ); if (is_null($result)) { $result = $this->callAuthCallback($user, $ability, $arguments); } // After calling the authorization callback, we will call the "after" callbacks // that are registered with the Gate, which allows a developer to do logging // if that is required for this application. Then we'll return the result. return tap($this->callAfterCallbacks( $user, $ability, $arguments, $result ), function ($result) use ($user, $ability, $arguments) { $this->dispatchGateEvaluatedEvent($user, $ability, $arguments, $result); }); } /** * Determine whether the callback/method can be called with the given user. * * @param \Illuminate\Contracts\Auth\Authenticatable|null $user * @param \Closure|string|array $class * @param string|null $method * @return bool */ protected function canBeCalledWithUser($user, $class, $method = null) { if (! is_null($user)) { return true; } if (! is_null($method)) { return $this->methodAllowsGuests($class, $method); } if (is_array($class)) { $className = is_string($class[0]) ? $class[0] : get_class($class[0]); return $this->methodAllowsGuests($className, $class[1]); } return $this->callbackAllowsGuests($class); } /** * Determine if the given class method allows guests. * * @param string $class * @param string $method * @return bool */ protected function methodAllowsGuests($class, $method) { try { $reflection = new ReflectionClass($class); $method = $reflection->getMethod($method); } catch (Exception) { return false; } if ($method) { $parameters = $method->getParameters(); return isset($parameters[0]) && $this->parameterAllowsGuests($parameters[0]); } return false; } /** * Determine if the callback allows guests. * * @param callable $callback * @return bool * * @throws \ReflectionException */ protected function callbackAllowsGuests($callback) { $parameters = (new ReflectionFunction($callback))->getParameters(); return isset($parameters[0]) && $this->parameterAllowsGuests($parameters[0]); } /** * Determine if the given parameter allows guests. * * @param \ReflectionParameter $parameter * @return bool */ protected function parameterAllowsGuests($parameter) { return ($parameter->hasType() && $parameter->allowsNull()) || ($parameter->isDefaultValueAvailable() && is_null($parameter->getDefaultValue())); } /** * Resolve and call the appropriate authorization callback. * * @param \Illuminate\Contracts\Auth\Authenticatable|null $user * @param string $ability * @param array $arguments * @return bool */ protected function callAuthCallback($user, $ability, array $arguments) { $callback = $this->resolveAuthCallback($user, $ability, $arguments); return $callback($user, ...$arguments); } /** * Call all of the before callbacks and return if a result is given. * * @param \Illuminate\Contracts\Auth\Authenticatable|null $user * @param string $ability * @param array $arguments * @return bool|null */ protected function callBeforeCallbacks($user, $ability, array $arguments) { foreach ($this->beforeCallbacks as $before) { if (! $this->canBeCalledWithUser($user, $before)) { continue; } if (! is_null($result = $before($user, $ability, $arguments))) { return $result; } } } /** * Call all of the after callbacks with check result. * * @param \Illuminate\Contracts\Auth\Authenticatable $user * @param string $ability * @param array $arguments * @param bool $result * @return bool|null */ protected function callAfterCallbacks($user, $ability, array $arguments, $result) { foreach ($this->afterCallbacks as $after) { if (! $this->canBeCalledWithUser($user, $after)) { continue; } $afterResult = $after($user, $ability, $result, $arguments); $result ??= $afterResult; } return $result; } /** * Dispatch a gate evaluation event. * * @param \Illuminate\Contracts\Auth\Authenticatable|null $user * @param string $ability * @param array $arguments * @param bool|null $result * @return void */ protected function dispatchGateEvaluatedEvent($user, $ability, array $arguments, $result) { if ($this->container->bound(Dispatcher::class)) { $this->container->make(Dispatcher::class)->dispatch( new GateEvaluated($user, $ability, $result, $arguments) ); } } /** * Resolve the callable for the given ability and arguments. * * @param \Illuminate\Contracts\Auth\Authenticatable|null $user * @param string $ability * @param array $arguments * @return callable */ protected function resolveAuthCallback($user, $ability, array $arguments) { if (isset($arguments[0]) && ! is_null($policy = $this->getPolicyFor($arguments[0])) && $callback = $this->resolvePolicyCallback($user, $ability, $arguments, $policy)) { return $callback; } if (isset($this->stringCallbacks[$ability])) { [$class, $method] = Str::parseCallback($this->stringCallbacks[$ability]); if ($this->canBeCalledWithUser($user, $class, $method ?: '__invoke')) { return $this->abilities[$ability]; } } if (isset($this->abilities[$ability]) && $this->canBeCalledWithUser($user, $this->abilities[$ability])) { return $this->abilities[$ability]; } return function () { // }; } /** * Get a policy instance for a given class. * * @param object|string $class * @return mixed */ public function getPolicyFor($class) { if (is_object($class)) { $class = get_class($class); } if (! is_string($class)) { return; } if (isset($this->policies[$class])) { return $this->resolvePolicy($this->policies[$class]); } foreach ($this->guessPolicyName($class) as $guessedPolicy) { if (class_exists($guessedPolicy)) { return $this->resolvePolicy($guessedPolicy); } } foreach ($this->policies as $expected => $policy) { if (is_subclass_of($class, $expected)) { return $this->resolvePolicy($policy); } } } /** * Guess the policy name for the given class. * * @param string $class * @return array */ protected function guessPolicyName($class) { if ($this->guessPolicyNamesUsingCallback) { return Arr::wrap(call_user_func($this->guessPolicyNamesUsingCallback, $class)); } $classDirname = str_replace('/', '\\', dirname(str_replace('\\', '/', $class))); $classDirnameSegments = explode('\\', $classDirname); return Arr::wrap(Collection::times(count($classDirnameSegments), function ($index) use ($class, $classDirnameSegments) { $classDirname = implode('\\', array_slice($classDirnameSegments, 0, $index)); return $classDirname.'\\Policies\\'.class_basename($class).'Policy'; })->reverse()->values()->first(function ($class) { return class_exists($class); }) ?: [$classDirname.'\\Policies\\'.class_basename($class).'Policy']); } /** * Specify a callback to be used to guess policy names. * * @param callable $callback * @return $this */ public function guessPolicyNamesUsing(callable $callback) { $this->guessPolicyNamesUsingCallback = $callback; return $this; } /** * Build a policy class instance of the given type. * * @param object|string $class * @return mixed * * @throws \Illuminate\Contracts\Container\BindingResolutionException */ public function resolvePolicy($class) { return $this->container->make($class); } /** * Resolve the callback for a policy check. * * @param \Illuminate\Contracts\Auth\Authenticatable $user * @param string $ability * @param array $arguments * @param mixed $policy * @return bool|callable */ protected function resolvePolicyCallback($user, $ability, array $arguments, $policy) { if (! is_callable([$policy, $this->formatAbilityToMethod($ability)])) { return false; } return function () use ($user, $ability, $arguments, $policy) { // This callback will be responsible for calling the policy's before method and // running this policy method if necessary. This is used to when objects are // mapped to policy objects in the user's configurations or on this class. $result = $this->callPolicyBefore( $policy, $user, $ability, $arguments ); // When we receive a non-null result from this before method, we will return it // as the "final" results. This will allow developers to override the checks // in this policy to return the result for all rules defined in the class. if (! is_null($result)) { return $result; } $method = $this->formatAbilityToMethod($ability); return $this->callPolicyMethod($policy, $method, $user, $arguments); }; } /** * Call the "before" method on the given policy, if applicable. * * @param mixed $policy * @param \Illuminate\Contracts\Auth\Authenticatable $user * @param string $ability * @param array $arguments * @return mixed */ protected function callPolicyBefore($policy, $user, $ability, $arguments) { if (! method_exists($policy, 'before')) { return; } if ($this->canBeCalledWithUser($user, $policy, 'before')) { return $policy->before($user, $ability, ...$arguments); } } /** * Call the appropriate method on the given policy. * * @param mixed $policy * @param string $method * @param \Illuminate\Contracts\Auth\Authenticatable|null $user * @param array $arguments * @return mixed */ protected function callPolicyMethod($policy, $method, $user, array $arguments) { // If this first argument is a string, that means they are passing a class name // to the policy. We will remove the first argument from this argument array // because this policy already knows what type of models it can authorize. if (isset($arguments[0]) && is_string($arguments[0])) { array_shift($arguments); } if (! is_callable([$policy, $method])) { return; } if ($this->canBeCalledWithUser($user, $policy, $method)) { return $policy->{$method}($user, ...$arguments); } } /** * Format the policy ability into a method name. * * @param string $ability * @return string */ protected function formatAbilityToMethod($ability) { return str_contains($ability, '-') ? Str::camel($ability) : $ability; } /** * Get a gate instance for the given user. * * @param \Illuminate\Contracts\Auth\Authenticatable|mixed $user * @return static */ public function forUser($user) { $callback = fn () => $user; return new static( $this->container, $callback, $this->abilities, $this->policies, $this->beforeCallbacks, $this->afterCallbacks, $this->guessPolicyNamesUsingCallback ); } /** * Resolve the user from the user resolver. * * @return mixed */ protected function resolveUser() { return call_user_func($this->userResolver); } /** * Get all of the defined abilities. * * @return array */ public function abilities() { return $this->abilities; } /** * Get all of the defined policies. * * @return array */ public function policies() { return $this->policies; } /** * Set the default denial response for gates and policies. * * @param \Illuminate\Auth\Access\Response $response * @return $this */ public function defaultDenialResponse(Response $response) { $this->defaultDenialResponse = $response; return $this; } /** * Set the container instance used by the gate. * * @param \Illuminate\Contracts\Container\Container $container * @return $this */ public function setContainer(Container $container) { $this->container = $container; return $this; } } PKO$W]^Ôœ'src/Illuminate/Auth/Access/Response.phpnu„[µü¤code = $code; $this->allowed = $allowed; $this->message = $message; } /** * Create a new "allow" Response. * * @param string|null $message * @param mixed $code * @return \Illuminate\Auth\Access\Response */ public static function allow($message = null, $code = null) { return new static(true, $message, $code); } /** * Create a new "deny" Response. * * @param string|null $message * @param mixed $code * @return \Illuminate\Auth\Access\Response */ public static function deny($message = null, $code = null) { return new static(false, $message, $code); } /** * Create a new "deny" Response with a HTTP status code. * * @param int $status * @param string|null $message * @param mixed $code * @return \Illuminate\Auth\Access\Response */ public static function denyWithStatus($status, $message = null, $code = null) { return static::deny($message, $code)->withStatus($status); } /** * Create a new "deny" Response with a 404 HTTP status code. * * @param string|null $message * @param mixed $code * @return \Illuminate\Auth\Access\Response */ public static function denyAsNotFound($message = null, $code = null) { return static::denyWithStatus(404, $message, $code); } /** * Determine if the response was allowed. * * @return bool */ public function allowed() { return $this->allowed; } /** * Determine if the response was denied. * * @return bool */ public function denied() { return ! $this->allowed(); } /** * Get the response message. * * @return string|null */ public function message() { return $this->message; } /** * Get the response code / reason. * * @return mixed */ public function code() { return $this->code; } /** * Throw authorization exception if response was denied. * * @return \Illuminate\Auth\Access\Response * * @throws \Illuminate\Auth\Access\AuthorizationException */ public function authorize() { if ($this->denied()) { throw (new AuthorizationException($this->message(), $this->code())) ->setResponse($this) ->withStatus($this->status); } return $this; } /** * Set the HTTP response status code. * * @param null|int $status * @return $this */ public function withStatus($status) { $this->status = $status; return $this; } /** * Set the HTTP response status code to 404. * * @return $this */ public function asNotFound() { return $this->withStatus(404); } /** * Get the HTTP status code. * * @return int|null */ public function status() { return $this->status; } /** * Convert the response to an array. * * @return array */ public function toArray() { return [ 'allowed' => $this->allowed(), 'message' => $this->message(), 'code' => $this->code(), ]; } /** * Get the string representation of the message. * * @return string */ public function __toString() { return (string) $this->message(); } } PKO$W]ŸCÉ»»5src/Illuminate/Auth/Access/AuthorizationException.phpnu„[µü¤code = $code ?: 0; } /** * Get the response from the gate. * * @return \Illuminate\Auth\Access\Response */ public function response() { return $this->response; } /** * Set the response from the gate. * * @param \Illuminate\Auth\Access\Response $response * @return $this */ public function setResponse($response) { $this->response = $response; return $this; } /** * Set the HTTP response status code. * * @param int|null $status * @return $this */ public function withStatus($status) { $this->status = $status; return $this; } /** * Set the HTTP response status code to 404. * * @return $this */ public function asNotFound() { return $this->withStatus(404); } /** * Determine if the HTTP status code has been set. * * @return bool */ public function hasStatus() { return $this->status !== null; } /** * Get the HTTP status code. * * @return int|null */ public function status() { return $this->status; } /** * Create a deny response object from this exception. * * @return \Illuminate\Auth\Access\Response */ public function toResponse() { return Response::deny($this->message, $this->code)->withStatus($this->status); } } PKO$W]¾�ÛÄÝÝ3src/Illuminate/Auth/Access/Events/GateEvaluated.phpnu„[µü¤user = $user; $this->ability = $ability; $this->result = $result; $this->arguments = $arguments; } } PKO$W]IE{»ZZ2src/Illuminate/Auth/Console/ClearResetsCommand.phpnu„[µü¤laravel['auth.password']->broker($this->argument('name'))->getRepository()->deleteExpired(); $this->components->info('Expired reset tokens cleared successfully.'); } } PKO$W]1`µ# # =src/Illuminate/Auth/Console/stubs/make/views/layouts/app.stubnu„[µü¤ {{ config('app.name', 'Laravel') }}
@yield('content')
PKO$W]ér–i==%src/Illuminate/Auth/Events/Failed.phpnu„[µü¤user = $user; $this->guard = $guard; $this->credentials = $credentials; } } PKO$W]àVd««(src/Illuminate/Auth/Events/Validated.phpnu„[µü¤user = $user; $this->guard = $guard; } } PKO$W]L@Ì××,src/Illuminate/Auth/Events/PasswordReset.phpnu„[µü¤user = $user; } } PKO$W]½~áââ)src/Illuminate/Auth/Events/Registered.phpnu„[µü¤user = $user; } } PKO$W]Üy€±‡‡%src/Illuminate/Auth/Events/Logout.phpnu„[µü¤user = $user; $this->guard = $guard; } } PKO$W]È=ãï’’0src/Illuminate/Auth/Events/OtherDeviceLogout.phpnu„[µü¤user = $user; $this->guard = $guard; } } PKO$W]"(´””2src/Illuminate/Auth/Events/CurrentDeviceLogout.phpnu„[µü¤user = $user; $this->guard = $guard; } } PKO$W]Ó»0ÌŽŽ,src/Illuminate/Auth/Events/Authenticated.phpnu„[µü¤user = $user; $this->guard = $guard; } } PKO$W]¢w:÷êê)src/Illuminate/Auth/Events/Attempting.phpnu„[µü¤guard = $guard; $this->remember = $remember; $this->credentials = $credentials; } } PKO$W]n±»¸¬¬&src/Illuminate/Auth/Events/Lockout.phpnu„[µü¤request = $request; } } PKO$W]^ûÞXÛÛ'src/Illuminate/Auth/Events/Verified.phpnu„[µü¤user = $user; } } PKO$W]ìÑ+II$src/Illuminate/Auth/Events/Login.phpnu„[µü¤user = $user; $this->guard = $guard; $this->remember = $remember; } } PKO$W]c¹Èú ú #src/Illuminate/Auth/GenericUser.phpnu„[µü¤attributes = $attributes; } /** * Get the name of the unique identifier for the user. * * @return string */ public function getAuthIdentifierName() { return 'id'; } /** * Get the unique identifier for the user. * * @return mixed */ public function getAuthIdentifier() { return $this->attributes[$this->getAuthIdentifierName()]; } /** * Get the password for the user. * * @return string */ public function getAuthPassword() { return $this->attributes['password']; } /** * Get the "remember me" token value. * * @return string */ public function getRememberToken() { return $this->attributes[$this->getRememberTokenName()]; } /** * Set the "remember me" token value. * * @param string $value * @return void */ public function setRememberToken($value) { $this->attributes[$this->getRememberTokenName()] = $value; } /** * Get the column name for the "remember me" token. * * @return string */ public function getRememberTokenName() { return 'remember_token'; } /** * Dynamically access the user's attributes. * * @param string $key * @return mixed */ public function __get($key) { return $this->attributes[$key]; } /** * Dynamically set an attribute on the user. * * @param string $key * @param mixed $value * @return void */ public function __set($key, $value) { $this->attributes[$key] = $value; } /** * Dynamically check if a value is set on the user. * * @param string $key * @return bool */ public function __isset($key) { return isset($this->attributes[$key]); } /** * Dynamically unset a value on the user. * * @param string $key * @return void */ public function __unset($key) { unset($this->attributes[$key]); } } PKO$W]·ü ´!!#src/Illuminate/Auth/AuthManager.phpnu„[µü¤app = $app; $this->userResolver = fn ($guard = null) => $this->guard($guard)->user(); } /** * Attempt to get the guard from the local cache. * * @param string|null $name * @return \Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard */ public function guard($name = null) { $name = $name ?: $this->getDefaultDriver(); return $this->guards[$name] ?? $this->guards[$name] = $this->resolve($name); } /** * Resolve the given guard. * * @param string $name * @return \Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard * * @throws \InvalidArgumentException */ protected function resolve($name) { $config = $this->getConfig($name); if (is_null($config)) { throw new InvalidArgumentException("Auth guard [{$name}] is not defined."); } if (isset($this->customCreators[$config['driver']])) { return $this->callCustomCreator($name, $config); } $driverMethod = 'create'.ucfirst($config['driver']).'Driver'; if (method_exists($this, $driverMethod)) { return $this->{$driverMethod}($name, $config); } throw new InvalidArgumentException( "Auth driver [{$config['driver']}] for guard [{$name}] is not defined." ); } /** * Call a custom driver creator. * * @param string $name * @param array $config * @return mixed */ protected function callCustomCreator($name, array $config) { return $this->customCreators[$config['driver']]($this->app, $name, $config); } /** * Create a session based authentication guard. * * @param string $name * @param array $config * @return \Illuminate\Auth\SessionGuard */ public function createSessionDriver($name, $config) { $provider = $this->createUserProvider($config['provider'] ?? null); $guard = new SessionGuard( $name, $provider, $this->app['session.store'], ); // When using the remember me functionality of the authentication services we // will need to be set the encryption instance of the guard, which allows // secure, encrypted cookie values to get generated for those cookies. if (method_exists($guard, 'setCookieJar')) { $guard->setCookieJar($this->app['cookie']); } if (method_exists($guard, 'setDispatcher')) { $guard->setDispatcher($this->app['events']); } if (method_exists($guard, 'setRequest')) { $guard->setRequest($this->app->refresh('request', $guard, 'setRequest')); } if (isset($config['remember'])) { $guard->setRememberDuration($config['remember']); } return $guard; } /** * Create a token based authentication guard. * * @param string $name * @param array $config * @return \Illuminate\Auth\TokenGuard */ public function createTokenDriver($name, $config) { // The token guard implements a basic API token based guard implementation // that takes an API token field from the request and matches it to the // user in the database or another persistence layer where users are. $guard = new TokenGuard( $this->createUserProvider($config['provider'] ?? null), $this->app['request'], $config['input_key'] ?? 'api_token', $config['storage_key'] ?? 'api_token', $config['hash'] ?? false ); $this->app->refresh('request', $guard, 'setRequest'); return $guard; } /** * Get the guard configuration. * * @param string $name * @return array */ protected function getConfig($name) { return $this->app['config']["auth.guards.{$name}"]; } /** * Get the default authentication driver name. * * @return string */ public function getDefaultDriver() { return $this->app['config']['auth.defaults.guard']; } /** * Set the default guard driver the factory should serve. * * @param string $name * @return void */ public function shouldUse($name) { $name = $name ?: $this->getDefaultDriver(); $this->setDefaultDriver($name); $this->userResolver = fn ($name = null) => $this->guard($name)->user(); } /** * Set the default authentication driver name. * * @param string $name * @return void */ public function setDefaultDriver($name) { $this->app['config']['auth.defaults.guard'] = $name; } /** * Register a new callback based request guard. * * @param string $driver * @param callable $callback * @return $this */ public function viaRequest($driver, callable $callback) { return $this->extend($driver, function () use ($callback) { $guard = new RequestGuard($callback, $this->app['request'], $this->createUserProvider()); $this->app->refresh('request', $guard, 'setRequest'); return $guard; }); } /** * Get the user resolver callback. * * @return \Closure */ public function userResolver() { return $this->userResolver; } /** * Set the callback to be used to resolve users. * * @param \Closure $userResolver * @return $this */ public function resolveUsersUsing(Closure $userResolver) { $this->userResolver = $userResolver; return $this; } /** * Register a custom driver creator Closure. * * @param string $driver * @param \Closure $callback * @return $this */ public function extend($driver, Closure $callback) { $this->customCreators[$driver] = $callback; return $this; } /** * Register a custom provider creator Closure. * * @param string $name * @param \Closure $callback * @return $this */ public function provider($name, Closure $callback) { $this->customProviderCreators[$name] = $callback; return $this; } /** * Determines if any guards have already been resolved. * * @return bool */ public function hasResolvedGuards() { return count($this->guards) > 0; } /** * Forget all of the resolved guard instances. * * @return $this */ public function forgetGuards() { $this->guards = []; return $this; } /** * Set the application instance used by the manager. * * @param \Illuminate\Contracts\Foundation\Application $app * @return $this */ public function setApplication($app) { $this->app = $app; return $this; } /** * Dynamically call the default driver instance. * * @param string $method * @param array $parameters * @return mixed */ public function __call($method, $parameters) { return $this->guard()->{$method}(...$parameters); } } PKO$W]rl7ÓÓ'src/Illuminate/Auth/MustVerifyEmail.phpnu„[µü¤email_verified_at); } /** * Mark the given user's email as verified. * * @return bool */ public function markEmailAsVerified() { return $this->forceFill([ 'email_verified_at' => $this->freshTimestamp(), ])->save(); } /** * Send the email verification notification. * * @return void */ public function sendEmailVerificationNotification() { $this->notify(new VerifyEmail); } /** * Get the email address that should be used for verification. * * @return string */ public function getEmailForVerification() { return $this->email; } } PKO$W]XJ:úú'src/Illuminate/Auth/Authenticatable.phpnu„[µü¤getKeyName(); } /** * Get the unique identifier for the user. * * @return mixed */ public function getAuthIdentifier() { return $this->{$this->getAuthIdentifierName()}; } /** * Get the unique broadcast identifier for the user. * * @return mixed */ public function getAuthIdentifierForBroadcasting() { return $this->getAuthIdentifier(); } /** * Get the password for the user. * * @return string */ public function getAuthPassword() { return $this->password; } /** * Get the token value for the "remember me" session. * * @return string|null */ public function getRememberToken() { if (! empty($this->getRememberTokenName())) { return (string) $this->{$this->getRememberTokenName()}; } } /** * Set the token value for the "remember me" session. * * @param string $value * @return void */ public function setRememberToken($value) { if (! empty($this->getRememberTokenName())) { $this->{$this->getRememberTokenName()} = $value; } } /** * Get the column name for the "remember me" token. * * @return string */ public function getRememberTokenName() { return $this->rememberTokenName; } } PKO$W]¦a@¢ee,src/Illuminate/Auth/DatabaseUserProvider.phpnu„[µü¤connection = $connection; $this->table = $table; $this->hasher = $hasher; } /** * Retrieve a user by their unique identifier. * * @param mixed $identifier * @return \Illuminate\Contracts\Auth\Authenticatable|null */ public function retrieveById($identifier) { $user = $this->connection->table($this->table)->find($identifier); return $this->getGenericUser($user); } /** * Retrieve a user by their unique identifier and "remember me" token. * * @param mixed $identifier * @param string $token * @return \Illuminate\Contracts\Auth\Authenticatable|null */ public function retrieveByToken($identifier, $token) { $user = $this->getGenericUser( $this->connection->table($this->table)->find($identifier) ); return $user && $user->getRememberToken() && hash_equals($user->getRememberToken(), $token) ? $user : null; } /** * Update the "remember me" token for the given user in storage. * * @param \Illuminate\Contracts\Auth\Authenticatable $user * @param string $token * @return void */ public function updateRememberToken(UserContract $user, $token) { $this->connection->table($this->table) ->where($user->getAuthIdentifierName(), $user->getAuthIdentifier()) ->update([$user->getRememberTokenName() => $token]); } /** * Retrieve a user by the given credentials. * * @param array $credentials * @return \Illuminate\Contracts\Auth\Authenticatable|null */ public function retrieveByCredentials(array $credentials) { $credentials = array_filter( $credentials, fn ($key) => ! str_contains($key, 'password'), ARRAY_FILTER_USE_KEY ); if (empty($credentials)) { return; } // First we will add each credential element to the query as a where clause. // Then we can execute the query and, if we found a user, return it in a // generic "user" object that will be utilized by the Guard instances. $query = $this->connection->table($this->table); foreach ($credentials as $key => $value) { if (is_array($value) || $value instanceof Arrayable) { $query->whereIn($key, $value); } elseif ($value instanceof Closure) { $value($query); } else { $query->where($key, $value); } } // Now we are ready to execute the query to see if we have a user matching // the given credentials. If not, we will just return null and indicate // that there are no matching users from the given credential arrays. $user = $query->first(); return $this->getGenericUser($user); } /** * Get the generic user. * * @param mixed $user * @return \Illuminate\Auth\GenericUser|null */ protected function getGenericUser($user) { if (! is_null($user)) { return new GenericUser((array) $user); } } /** * Validate a user against the given credentials. * * @param \Illuminate\Contracts\Auth\Authenticatable $user * @param array $credentials * @return bool */ public function validateCredentials(UserContract $user, array $credentials) { return $this->hasher->check( $credentials['password'], $user->getAuthPassword() ); } } PKO$W] p \x x "src/Illuminate/Auth/TokenGuard.phpnu„[µü¤hash = $hash; $this->request = $request; $this->provider = $provider; $this->inputKey = $inputKey; $this->storageKey = $storageKey; } /** * Get the currently authenticated user. * * @return \Illuminate\Contracts\Auth\Authenticatable|null */ public function user() { // If we've already retrieved the user for the current request we can just // return it back immediately. We do not want to fetch the user data on // every call to this method because that would be tremendously slow. if (! is_null($this->user)) { return $this->user; } $user = null; $token = $this->getTokenForRequest(); if (! empty($token)) { $user = $this->provider->retrieveByCredentials([ $this->storageKey => $this->hash ? hash('sha256', $token) : $token, ]); } return $this->user = $user; } /** * Get the token for the current request. * * @return string|null */ public function getTokenForRequest() { $token = $this->request->query($this->inputKey); if (empty($token)) { $token = $this->request->input($this->inputKey); } if (empty($token)) { $token = $this->request->bearerToken(); } if (empty($token)) { $token = $this->request->getPassword(); } return $token; } /** * Validate a user's credentials. * * @param array $credentials * @return bool */ public function validate(array $credentials = []) { if (empty($credentials[$this->inputKey])) { return false; } $credentials = [$this->storageKey => $credentials[$this->inputKey]]; if ($this->provider->retrieveByCredentials($credentials)) { return true; } return false; } /** * Set the current request instance. * * @param \Illuminate\Http\Request $request * @return $this */ public function setRequest(Request $request) { $this->request = $request; return $this; } } PKO$W]/ù¬¬¬'src/Illuminate/Foundation/Auth/User.phpnu„[µü¤forUser($this)->check($abilities, $arguments); } /** * Determine if the entity has any of the given abilities. * * @param iterable|string $abilities * @param array|mixed $arguments * @return bool */ public function canAny($abilities, $arguments = []) { return app(Gate::class)->forUser($this)->any($abilities, $arguments); } /** * Determine if the entity does not have the given abilities. * * @param iterable|string $abilities * @param array|mixed $arguments * @return bool */ public function cant($abilities, $arguments = []) { return ! $this->can($abilities, $arguments); } /** * Determine if the entity does not have the given abilities. * * @param iterable|string $abilities * @param array|mixed $arguments * @return bool */ public function cannot($abilities, $arguments = []) { return $this->cant($abilities, $arguments); } } PKO$W]eµ¡m··<src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.phpnu„[µü¤parseAbilityAndArguments($ability, $arguments); return app(Gate::class)->authorize($ability, $arguments); } /** * Authorize a given action for a user. * * @param \Illuminate\Contracts\Auth\Authenticatable|mixed $user * @param mixed $ability * @param mixed|array $arguments * @return \Illuminate\Auth\Access\Response * * @throws \Illuminate\Auth\Access\AuthorizationException */ public function authorizeForUser($user, $ability, $arguments = []) { [$ability, $arguments] = $this->parseAbilityAndArguments($ability, $arguments); return app(Gate::class)->forUser($user)->authorize($ability, $arguments); } /** * Guesses the ability's name if it wasn't provided. * * @param mixed $ability * @param mixed|array $arguments * @return array */ protected function parseAbilityAndArguments($ability, $arguments) { if (is_string($ability) && ! str_contains($ability, '\\')) { return [$ability, $arguments]; } $method = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3)[2]['function']; return [$this->normalizeGuessedAbilityName($method), $ability]; } /** * Normalize the ability name that has been guessed from the method name. * * @param string $ability * @return string */ protected function normalizeGuessedAbilityName($ability) { $map = $this->resourceAbilityMap(); return $map[$ability] ?? $ability; } /** * Authorize a resource action based on the incoming request. * * @param string|array $model * @param string|array|null $parameter * @param array $options * @param \Illuminate\Http\Request|null $request * @return void */ public function authorizeResource($model, $parameter = null, array $options = [], $request = null) { $model = is_array($model) ? implode(',', $model) : $model; $parameter = is_array($parameter) ? implode(',', $parameter) : $parameter; $parameter = $parameter ?: Str::snake(class_basename($model)); $middleware = []; foreach ($this->resourceAbilityMap() as $method => $ability) { $modelName = in_array($method, $this->resourceMethodsWithoutModels()) ? $model : $parameter; $middleware["can:{$ability},{$modelName}"][] = $method; } foreach ($middleware as $middlewareName => $methods) { $this->middleware($middlewareName, $options)->only($methods); } } /** * Get the map of resource methods to ability names. * * @return array */ protected function resourceAbilityMap() { return [ 'index' => 'viewAny', 'show' => 'view', 'create' => 'create', 'store' => 'create', 'edit' => 'update', 'update' => 'update', 'destroy' => 'delete', ]; } /** * Get the list of resource methods which do not have model parameters. * * @return array */ protected function resourceMethodsWithoutModels() { return ['index', 'create', 'store']; } } PKO$W]›ƒä)‡‡;src/Illuminate/Foundation/Auth/EmailVerificationRequest.phpnu„[µü¤user()->getKey(), (string) $this->route('id'))) { return false; } if (! hash_equals(sha1($this->user()->getEmailForVerification()), (string) $this->route('hash'))) { return false; } return true; } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ // ]; } /** * Fulfill the email verification request. * * @return void */ public function fulfill() { if (! $this->user()->hasVerifiedEmail()) { $this->user()->markEmailAsVerified(); event(new Verified($this->user())); } } /** * Configure the validator instance. * * @param \Illuminate\Validation\Validator $validator * @return \Illuminate\Validation\Validator */ public function withValidator(Validator $validator) { return $validator; } } PKO$W]5zéSS"src/Illuminate/Foundation/Vite.phpnu„[µü¤preloadedAssets; } /** * Get the Content Security Policy nonce applied to all generated tags. * * @return string|null */ public function cspNonce() { return $this->nonce; } /** * Generate or set a Content Security Policy nonce to apply to all generated tags. * * @param string|null $nonce * @return string */ public function useCspNonce($nonce = null) { return $this->nonce = $nonce ?? Str::random(40); } /** * Use the given key to detect integrity hashes in the manifest. * * @param string|false $key * @return $this */ public function useIntegrityKey($key) { $this->integrityKey = $key; return $this; } /** * Set the Vite entry points. * * @param array $entryPoints * @return $this */ public function withEntryPoints($entryPoints) { $this->entryPoints = $entryPoints; return $this; } /** * Set the filename for the manifest file. * * @param string $filename * @return $this */ public function useManifestFilename($filename) { $this->manifestFilename = $filename; return $this; } /** * Resolve asset paths using the provided resolver. * * @param callable|null $urlResolver * @return $this */ public function createAssetPathsUsing($resolver) { $this->assetPathResolver = $resolver; return $this; } /** * Get the Vite "hot" file path. * * @return string */ public function hotFile() { return $this->hotFile ?? public_path('/hot'); } /** * Set the Vite "hot" file path. * * @param string $path * @return $this */ public function useHotFile($path) { $this->hotFile = $path; return $this; } /** * Set the Vite build directory. * * @param string $path * @return $this */ public function useBuildDirectory($path) { $this->buildDirectory = $path; return $this; } /** * Use the given callback to resolve attributes for script tags. * * @param (callable(string, string, ?array, ?array): array)|array $attributes * @return $this */ public function useScriptTagAttributes($attributes) { if (! is_callable($attributes)) { $attributes = fn () => $attributes; } $this->scriptTagAttributesResolvers[] = $attributes; return $this; } /** * Use the given callback to resolve attributes for style tags. * * @param (callable(string, string, ?array, ?array): array)|array $attributes * @return $this */ public function useStyleTagAttributes($attributes) { if (! is_callable($attributes)) { $attributes = fn () => $attributes; } $this->styleTagAttributesResolvers[] = $attributes; return $this; } /** * Use the given callback to resolve attributes for preload tags. * * @param (callable(string, string, ?array, ?array): (array|false))|array|false $attributes * @return $this */ public function usePreloadTagAttributes($attributes) { if (! is_callable($attributes)) { $attributes = fn () => $attributes; } $this->preloadTagAttributesResolvers[] = $attributes; return $this; } /** * Generate Vite tags for an entrypoint. * * @param string|string[] $entrypoints * @param string|null $buildDirectory * @return \Illuminate\Support\HtmlString * * @throws \Exception */ public function __invoke($entrypoints, $buildDirectory = null) { $entrypoints = collect($entrypoints); $buildDirectory ??= $this->buildDirectory; if ($this->isRunningHot()) { return new HtmlString( $entrypoints ->prepend('@vite/client') ->map(fn ($entrypoint) => $this->makeTagForChunk($entrypoint, $this->hotAsset($entrypoint), null, null)) ->join('') ); } $manifest = $this->manifest($buildDirectory); $tags = collect(); $preloads = collect(); foreach ($entrypoints as $entrypoint) { $chunk = $this->chunk($manifest, $entrypoint); $preloads->push([ $chunk['src'], $this->assetPath("{$buildDirectory}/{$chunk['file']}"), $chunk, $manifest, ]); foreach ($chunk['imports'] ?? [] as $import) { $preloads->push([ $import, $this->assetPath("{$buildDirectory}/{$manifest[$import]['file']}"), $manifest[$import], $manifest, ]); foreach ($manifest[$import]['css'] ?? [] as $css) { $partialManifest = Collection::make($manifest)->where('file', $css); $preloads->push([ $partialManifest->keys()->first(), $this->assetPath("{$buildDirectory}/{$css}"), $partialManifest->first(), $manifest, ]); $tags->push($this->makeTagForChunk( $partialManifest->keys()->first(), $this->assetPath("{$buildDirectory}/{$css}"), $partialManifest->first(), $manifest )); } } $tags->push($this->makeTagForChunk( $entrypoint, $this->assetPath("{$buildDirectory}/{$chunk['file']}"), $chunk, $manifest )); foreach ($chunk['css'] ?? [] as $css) { $partialManifest = Collection::make($manifest)->where('file', $css); $preloads->push([ $partialManifest->keys()->first(), $this->assetPath("{$buildDirectory}/{$css}"), $partialManifest->first(), $manifest, ]); $tags->push($this->makeTagForChunk( $partialManifest->keys()->first(), $this->assetPath("{$buildDirectory}/{$css}"), $partialManifest->first(), $manifest )); } } [$stylesheets, $scripts] = $tags->unique()->partition(fn ($tag) => str_starts_with($tag, 'unique() ->sortByDesc(fn ($args) => $this->isCssPath($args[1])) ->map(fn ($args) => $this->makePreloadTagForChunk(...$args)); return new HtmlString($preloads->join('').$stylesheets->join('').$scripts->join('')); } /** * Make tag for the given chunk. * * @param string $src * @param string $url * @param array|null $chunk * @param array|null $manifest * @return string */ protected function makeTagForChunk($src, $url, $chunk, $manifest) { if ( $this->nonce === null && $this->integrityKey !== false && ! array_key_exists($this->integrityKey, $chunk ?? []) && $this->scriptTagAttributesResolvers === [] && $this->styleTagAttributesResolvers === []) { return $this->makeTag($url); } if ($this->isCssPath($url)) { return $this->makeStylesheetTagWithAttributes( $url, $this->resolveStylesheetTagAttributes($src, $url, $chunk, $manifest) ); } return $this->makeScriptTagWithAttributes( $url, $this->resolveScriptTagAttributes($src, $url, $chunk, $manifest) ); } /** * Make a preload tag for the given chunk. * * @param string $src * @param string $url * @param array $chunk * @param array $manifest * @return string */ protected function makePreloadTagForChunk($src, $url, $chunk, $manifest) { $attributes = $this->resolvePreloadTagAttributes($src, $url, $chunk, $manifest); if ($attributes === false) { return ''; } $this->preloadedAssets[$url] = $this->parseAttributes( Collection::make($attributes)->forget('href')->all() ); return 'parseAttributes($attributes)).' />'; } /** * Resolve the attributes for the chunks generated script tag. * * @param string $src * @param string $url * @param array|null $chunk * @param array|null $manifest * @return array */ protected function resolveScriptTagAttributes($src, $url, $chunk, $manifest) { $attributes = $this->integrityKey !== false ? ['integrity' => $chunk[$this->integrityKey] ?? false] : []; foreach ($this->scriptTagAttributesResolvers as $resolver) { $attributes = array_merge($attributes, $resolver($src, $url, $chunk, $manifest)); } return $attributes; } /** * Resolve the attributes for the chunks generated stylesheet tag. * * @param string $src * @param string $url * @param array|null $chunk * @param array|null $manifest * @return array */ protected function resolveStylesheetTagAttributes($src, $url, $chunk, $manifest) { $attributes = $this->integrityKey !== false ? ['integrity' => $chunk[$this->integrityKey] ?? false] : []; foreach ($this->styleTagAttributesResolvers as $resolver) { $attributes = array_merge($attributes, $resolver($src, $url, $chunk, $manifest)); } return $attributes; } /** * Resolve the attributes for the chunks generated preload tag. * * @param string $src * @param string $url * @param array $chunk * @param array $manifest * @return array|false */ protected function resolvePreloadTagAttributes($src, $url, $chunk, $manifest) { $attributes = $this->isCssPath($url) ? [ 'rel' => 'preload', 'as' => 'style', 'href' => $url, 'nonce' => $this->nonce ?? false, 'crossorigin' => $this->resolveStylesheetTagAttributes($src, $url, $chunk, $manifest)['crossorigin'] ?? false, ] : [ 'rel' => 'modulepreload', 'href' => $url, 'nonce' => $this->nonce ?? false, 'crossorigin' => $this->resolveScriptTagAttributes($src, $url, $chunk, $manifest)['crossorigin'] ?? false, ]; $attributes = $this->integrityKey !== false ? array_merge($attributes, ['integrity' => $chunk[$this->integrityKey] ?? false]) : $attributes; foreach ($this->preloadTagAttributesResolvers as $resolver) { if (false === ($resolvedAttributes = $resolver($src, $url, $chunk, $manifest))) { return false; } $attributes = array_merge($attributes, $resolvedAttributes); } return $attributes; } /** * Generate an appropriate tag for the given URL in HMR mode. * * @deprecated Will be removed in a future Laravel version. * * @param string $url * @return string */ protected function makeTag($url) { if ($this->isCssPath($url)) { return $this->makeStylesheetTag($url); } return $this->makeScriptTag($url); } /** * Generate a script tag for the given URL. * * @deprecated Will be removed in a future Laravel version. * * @param string $url * @return string */ protected function makeScriptTag($url) { return $this->makeScriptTagWithAttributes($url, []); } /** * Generate a stylesheet tag for the given URL in HMR mode. * * @deprecated Will be removed in a future Laravel version. * * @param string $url * @return string */ protected function makeStylesheetTag($url) { return $this->makeStylesheetTagWithAttributes($url, []); } /** * Generate a script tag with attributes for the given URL. * * @param string $url * @param array $attributes * @return string */ protected function makeScriptTagWithAttributes($url, $attributes) { $attributes = $this->parseAttributes(array_merge([ 'type' => 'module', 'src' => $url, 'nonce' => $this->nonce ?? false, ], $attributes)); return ''; } /** * Generate a link tag with attributes for the given URL. * * @param string $url * @param array $attributes * @return string */ protected function makeStylesheetTagWithAttributes($url, $attributes) { $attributes = $this->parseAttributes(array_merge([ 'rel' => 'stylesheet', 'href' => $url, 'nonce' => $this->nonce ?? false, ], $attributes)); return ''; } /** * Determine whether the given path is a CSS file. * * @param string $path * @return bool */ protected function isCssPath($path) { return preg_match('/\.(css|less|sass|scss|styl|stylus|pcss|postcss)$/', $path) === 1; } /** * Parse the attributes into key="value" strings. * * @param array $attributes * @return array */ protected function parseAttributes($attributes) { return Collection::make($attributes) ->reject(fn ($value, $key) => in_array($value, [false, null], true)) ->flatMap(fn ($value, $key) => $value === true ? [$key] : [$key => $value]) ->map(fn ($value, $key) => is_int($key) ? $value : $key.'="'.$value.'"') ->values() ->all(); } /** * Generate React refresh runtime script. * * @return \Illuminate\Support\HtmlString|void */ public function reactRefresh() { if (! $this->isRunningHot()) { return; } $attributes = $this->parseAttributes([ 'nonce' => $this->cspNonce(), ]); return new HtmlString( sprintf( <<<'HTML' HTML, implode(' ', $attributes), $this->hotAsset('@react-refresh') ) ); } /** * Get the path to a given asset when running in HMR mode. * * @return string */ protected function hotAsset($asset) { return rtrim(file_get_contents($this->hotFile())).'/'.$asset; } /** * Get the URL for an asset. * * @param string $asset * @param string|null $buildDirectory * @return string */ public function asset($asset, $buildDirectory = null) { $buildDirectory ??= $this->buildDirectory; if ($this->isRunningHot()) { return $this->hotAsset($asset); } $chunk = $this->chunk($this->manifest($buildDirectory), $asset); return $this->assetPath($buildDirectory.'/'.$chunk['file']); } /** * Get the content of a given asset. * * @param string $asset * @param string|null $buildDirectory * @return string * * @throws \Exception */ public function content($asset, $buildDirectory = null) { $buildDirectory ??= $this->buildDirectory; $chunk = $this->chunk($this->manifest($buildDirectory), $asset); $path = public_path($buildDirectory.'/'.$chunk['file']); if (! is_file($path) || ! file_exists($path)) { throw new Exception("Unable to locate file from Vite manifest: {$path}."); } return file_get_contents($path); } /** * Generate an asset path for the application. * * @param string $path * @param bool|null $secure * @return string */ protected function assetPath($path, $secure = null) { return ($this->assetPathResolver ?? asset(...))($path, $secure); } /** * Get the the manifest file for the given build directory. * * @param string $buildDirectory * @return array * * @throws \Illuminate\Foundation\ViteManifestNotFoundException */ protected function manifest($buildDirectory) { $path = $this->manifestPath($buildDirectory); if (! isset(static::$manifests[$path])) { if (! is_file($path)) { throw new ViteManifestNotFoundException("Vite manifest not found at: $path"); } static::$manifests[$path] = json_decode(file_get_contents($path), true); } return static::$manifests[$path]; } /** * Get the path to the manifest file for the given build directory. * * @param string $buildDirectory * @return string */ protected function manifestPath($buildDirectory) { return public_path($buildDirectory.'/'.$this->manifestFilename); } /** * Get a unique hash representing the current manifest, or null if there is no manifest. * * @param string|null $buildDirectory * @return string|null */ public function manifestHash($buildDirectory = null) { $buildDirectory ??= $this->buildDirectory; if ($this->isRunningHot()) { return null; } if (! is_file($path = $this->manifestPath($buildDirectory))) { return null; } return md5_file($path) ?: null; } /** * Get the chunk for the given entry point / asset. * * @param array $manifest * @param string $file * @return array * * @throws \Exception */ protected function chunk($manifest, $file) { if (! isset($manifest[$file])) { throw new Exception("Unable to locate file in Vite manifest: {$file}."); } return $manifest[$file]; } /** * Determine if the HMR server is running. * * @return bool */ public function isRunningHot() { return is_file($this->hotFile()); } /** * Get the Vite tag content as a string of HTML. * * @return string */ public function toHtml() { return $this->__invoke($this->entryPoints)->toHtml(); } } PKO$W]Ö¨ò>>*src/Illuminate/Foundation/Precognition.phpnu„[µü¤messages()->isEmpty() && $request->headers->has('Precognition-Validate-Only')) { abort(204, headers: ['Precognition-Success' => 'true']); } }; } } PKO$W]$"a  .src/Illuminate/Foundation/Bus/Dispatchable.phpnu„[µü¤dispatchSync(new static(...$arguments)); } /** * Dispatch a command to its appropriate handler after the current process. * * @param mixed ...$arguments * @return mixed */ public static function dispatchAfterResponse(...$arguments) { return self::dispatch(...$arguments)->afterResponse(); } /** * Set the jobs that should run if this job is successful. * * @param array $chain * @return \Illuminate\Foundation\Bus\PendingChain */ public static function withChain($chain) { return new PendingChain(static::class, $chain); } } PKO$W]ç#VD==0src/Illuminate/Foundation/Bus/DispatchesJobs.phpnu„[µü¤job = $job; $this->chain = $chain; } /** * Set the desired connection for the job. * * @param string|null $connection * @return $this */ public function onConnection($connection) { $this->connection = $connection; return $this; } /** * Set the desired queue for the job. * * @param string|null $queue * @return $this */ public function onQueue($queue) { $this->queue = $queue; return $this; } /** * Set the desired delay in seconds for the chain. * * @param \DateTimeInterface|\DateInterval|int|null $delay * @return $this */ public function delay($delay) { $this->delay = $delay; return $this; } /** * Add a callback to be executed on job failure. * * @param callable $callback * @return $this */ public function catch($callback) { $this->catchCallbacks[] = $callback instanceof Closure ? new SerializableClosure($callback) : $callback; return $this; } /** * Get the "catch" callbacks that have been registered. * * @return array */ public function catchCallbacks() { return $this->catchCallbacks ?? []; } /** * Dispatch the job chain. * * @return \Illuminate\Foundation\Bus\PendingDispatch */ public function dispatch() { if (is_string($this->job)) { $firstJob = new $this->job(...func_get_args()); } elseif ($this->job instanceof Closure) { $firstJob = CallQueuedClosure::create($this->job); } else { $firstJob = $this->job; } if ($this->connection) { $firstJob->chainConnection = $this->connection; $firstJob->connection = $firstJob->connection ?: $this->connection; } if ($this->queue) { $firstJob->chainQueue = $this->queue; $firstJob->queue = $firstJob->queue ?: $this->queue; } if ($this->delay) { $firstJob->delay = ! is_null($firstJob->delay) ? $firstJob->delay : $this->delay; } $firstJob->chain($this->chain); $firstJob->chainCatchCallbacks = $this->catchCallbacks(); return app(Dispatcher::class)->dispatch($firstJob); } /** * Dispatch the job chain if the given truth test passes. * * @param bool|\Closure $boolean * @return \Illuminate\Foundation\Bus\PendingDispatch|null */ public function dispatchIf($boolean) { return value($boolean) ? $this->dispatch() : null; } /** * Dispatch the job chain unless the given truth test passes. * * @param bool|\Closure $boolean * @return \Illuminate\Foundation\Bus\PendingDispatch|null */ public function dispatchUnless($boolean) { return ! value($boolean) ? $this->dispatch() : null; } } PKO$W]u±4±±1src/Illuminate/Foundation/Bus/PendingDispatch.phpnu„[µü¤job = $job; } /** * Set the desired connection for the job. * * @param string|null $connection * @return $this */ public function onConnection($connection) { $this->job->onConnection($connection); return $this; } /** * Set the desired queue for the job. * * @param string|null $queue * @return $this */ public function onQueue($queue) { $this->job->onQueue($queue); return $this; } /** * Set the desired connection for the chain. * * @param string|null $connection * @return $this */ public function allOnConnection($connection) { $this->job->allOnConnection($connection); return $this; } /** * Set the desired queue for the chain. * * @param string|null $queue * @return $this */ public function allOnQueue($queue) { $this->job->allOnQueue($queue); return $this; } /** * Set the desired delay in seconds for the job. * * @param \DateTimeInterface|\DateInterval|int|null $delay * @return $this */ public function delay($delay) { $this->job->delay($delay); return $this; } /** * Indicate that the job should be dispatched after all database transactions have committed. * * @return $this */ public function afterCommit() { $this->job->afterCommit(); return $this; } /** * Indicate that the job should not wait until database transactions have been committed before dispatching. * * @return $this */ public function beforeCommit() { $this->job->beforeCommit(); return $this; } /** * Set the jobs that should run if this job is successful. * * @param array $chain * @return $this */ public function chain($chain) { $this->job->chain($chain); return $this; } /** * Indicate that the job should be dispatched after the response is sent to the browser. * * @return $this */ public function afterResponse() { $this->afterResponse = true; return $this; } /** * Determine if the job should be dispatched. * * @return bool */ protected function shouldDispatch() { if (! $this->job instanceof ShouldBeUnique) { return true; } return (new UniqueLock(Container::getInstance()->make(Cache::class))) ->acquire($this->job); } /** * Dynamically proxy methods to the underlying job. * * @param string $method * @param array $parameters * @return $this */ public function __call($method, $parameters) { $this->job->{$method}(...$parameters); return $this; } /** * Handle the object's destruction. * * @return void */ public function __destruct() { if (! $this->shouldDispatch()) { return; } elseif ($this->afterResponse) { app(Dispatcher::class)->dispatchAfterResponse($this->job); } else { app(Dispatcher::class)->dispatch($this->job); } } } PKO$W]{K�tt8src/Illuminate/Foundation/Bus/PendingClosureDispatch.phpnu„[µü¤job->onFailure($callback); return $this; } } PKO$W]HŒÿ)zz;src/Illuminate/Foundation/ViteManifestNotFoundException.phpnu„[µü¤cache = $cache; $this->store = $store; $this->key = $key; } /** * Take the application down for maintenance. * * @param array $payload * @return void */ public function activate(array $payload): void { $this->getStore()->put($this->key, $payload); } /** * Take the application out of maintenance. * * @return void */ public function deactivate(): void { $this->getStore()->forget($this->key); } /** * Determine if the application is currently down for maintenance. * * @return bool */ public function active(): bool { return $this->getStore()->has($this->key); } /** * Get the data array which was provided when the application was placed into maintenance. * * @return array */ public function data(): array { return $this->getStore()->get($this->key); } /** * Get the cache store to use. * * @return \Illuminate\Contracts\Cache\Repository */ protected function getStore(): Repository { return $this->cache->store($this->store); } } PKO$W]‰Õ{''Dsrc/Illuminate/Foundation/Routing/PrecognitionCallableDispatcher.phpnu„[µü¤resolveParameters($route, $callable); abort(204, headers: ['Precognition-Success' => 'true']); } } PKO$W]}Ñ-‡ÂÂFsrc/Illuminate/Foundation/Routing/PrecognitionControllerDispatcher.phpnu„[µü¤ensureMethodExists($controller, $method); $this->resolveParameters($route, $controller, $method); abort(204, headers: ['Precognition-Success' => 'true']); } /** * Ensure that the given method exists on the controller. * * @param object $controller * @param string $method * @return $this */ protected function ensureMethodExists($controller, $method) { if (method_exists($controller, $method)) { return $this; } $class = $controller::class; throw new RuntimeException("Attempting to predict the outcome of the [{$class}::{$method}()] method but the method is not defined."); } } PKO$W]傥𿤿¤)src/Illuminate/Foundation/Application.phpnu„[µü¤setBasePath($basePath); } $this->registerBaseBindings(); $this->registerBaseServiceProviders(); $this->registerCoreContainerAliases(); $this->registerLaravelCloudServices(); } /** * Get the version number of the application. * * @return string */ public function version() { return static::VERSION; } /** * Register the basic bindings into the container. * * @return void */ protected function registerBaseBindings() { static::setInstance($this); $this->instance('app', $this); $this->instance(Container::class, $this); $this->singleton(Mix::class); $this->singleton(PackageManifest::class, fn () => new PackageManifest( new Filesystem, $this->basePath(), $this->getCachedPackagesPath() )); } /** * Register all of the base service providers. * * @return void */ protected function registerBaseServiceProviders() { $this->register(new EventServiceProvider($this)); $this->register(new LogServiceProvider($this)); $this->register(new RoutingServiceProvider($this)); } /** * Register any services needed for Laravel Cloud. * * @return void */ protected function registerLaravelCloudServices() { if (! laravel_cloud()) { return; } $this['events']->listen( 'bootstrapping: *', fn ($bootstrapper) => Cloud::bootstrapperBootstrapping($this, Str::after($bootstrapper, 'bootstrapping: ')) ); $this['events']->listen( 'bootstrapped: *', fn ($bootstrapper) => Cloud::bootstrapperBootstrapped($this, Str::after($bootstrapper, 'bootstrapped: ')) ); } /** * Run the given array of bootstrap classes. * * @param string[] $bootstrappers * @return void */ public function bootstrapWith(array $bootstrappers) { $this->hasBeenBootstrapped = true; foreach ($bootstrappers as $bootstrapper) { $this['events']->dispatch('bootstrapping: '.$bootstrapper, [$this]); $this->make($bootstrapper)->bootstrap($this); $this['events']->dispatch('bootstrapped: '.$bootstrapper, [$this]); } } /** * Register a callback to run after loading the environment. * * @param \Closure $callback * @return void */ public function afterLoadingEnvironment(Closure $callback) { $this->afterBootstrapping( LoadEnvironmentVariables::class, $callback ); } /** * Register a callback to run before a bootstrapper. * * @param string $bootstrapper * @param \Closure $callback * @return void */ public function beforeBootstrapping($bootstrapper, Closure $callback) { $this['events']->listen('bootstrapping: '.$bootstrapper, $callback); } /** * Register a callback to run after a bootstrapper. * * @param string $bootstrapper * @param \Closure $callback * @return void */ public function afterBootstrapping($bootstrapper, Closure $callback) { $this['events']->listen('bootstrapped: '.$bootstrapper, $callback); } /** * Determine if the application has been bootstrapped before. * * @return bool */ public function hasBeenBootstrapped() { return $this->hasBeenBootstrapped; } /** * Set the base path for the application. * * @param string $basePath * @return $this */ public function setBasePath($basePath) { $this->basePath = rtrim($basePath, '\/'); $this->bindPathsInContainer(); return $this; } /** * Bind all of the application paths in the container. * * @return void */ protected function bindPathsInContainer() { $this->instance('path', $this->path()); $this->instance('path.base', $this->basePath()); $this->instance('path.config', $this->configPath()); $this->instance('path.database', $this->databasePath()); $this->instance('path.public', $this->publicPath()); $this->instance('path.resources', $this->resourcePath()); $this->instance('path.storage', $this->storagePath()); $this->useBootstrapPath(value(function () { return is_dir($directory = $this->basePath('.laravel')) ? $directory : $this->basePath('bootstrap'); })); $this->useLangPath(value(function () { return is_dir($directory = $this->resourcePath('lang')) ? $directory : $this->basePath('lang'); })); } /** * Get the path to the application "app" directory. * * @param string $path * @return string */ public function path($path = '') { return $this->joinPaths($this->appPath ?: $this->basePath('app'), $path); } /** * Set the application directory. * * @param string $path * @return $this */ public function useAppPath($path) { $this->appPath = $path; $this->instance('path', $path); return $this; } /** * Get the base path of the Laravel installation. * * @param string $path * @return string */ public function basePath($path = '') { return $this->joinPaths($this->basePath, $path); } /** * Get the path to the bootstrap directory. * * @param string $path * @return string */ public function bootstrapPath($path = '') { return $this->joinPaths($this->bootstrapPath, $path); } /** * Set the bootstrap file directory. * * @param string $path * @return $this */ public function useBootstrapPath($path) { $this->bootstrapPath = $path; $this->instance('path.bootstrap', $path); return $this; } /** * Get the path to the application configuration files. * * @param string $path * @return string */ public function configPath($path = '') { return $this->joinPaths($this->configPath ?: $this->basePath('config'), $path); } /** * Set the configuration directory. * * @param string $path * @return $this */ public function useConfigPath($path) { $this->configPath = $path; $this->instance('path.config', $path); return $this; } /** * Get the path to the database directory. * * @param string $path * @return string */ public function databasePath($path = '') { return $this->joinPaths($this->databasePath ?: $this->basePath('database'), $path); } /** * Set the database directory. * * @param string $path * @return $this */ public function useDatabasePath($path) { $this->databasePath = $path; $this->instance('path.database', $path); return $this; } /** * Get the path to the language files. * * @param string $path * @return string */ public function langPath($path = '') { return $this->joinPaths($this->langPath, $path); } /** * Set the language file directory. * * @param string $path * @return $this */ public function useLangPath($path) { $this->langPath = $path; $this->instance('path.lang', $path); return $this; } /** * Get the path to the public / web directory. * * @param string $path * @return string */ public function publicPath($path = '') { return $this->joinPaths($this->publicPath ?: $this->basePath('public'), $path); } /** * Set the public / web directory. * * @param string $path * @return $this */ public function usePublicPath($path) { $this->publicPath = $path; $this->instance('path.public', $path); return $this; } /** * Get the path to the storage directory. * * @param string $path * @return string */ public function storagePath($path = '') { if (isset($_ENV['LARAVEL_STORAGE_PATH'])) { return $this->joinPaths($this->storagePath ?: $_ENV['LARAVEL_STORAGE_PATH'], $path); } if (isset($_SERVER['LARAVEL_STORAGE_PATH'])) { return $this->joinPaths($this->storagePath ?: $_SERVER['LARAVEL_STORAGE_PATH'], $path); } return $this->joinPaths($this->storagePath ?: $this->basePath('storage'), $path); } /** * Set the storage directory. * * @param string $path * @return $this */ public function useStoragePath($path) { $this->storagePath = $path; $this->instance('path.storage', $path); return $this; } /** * Get the path to the resources directory. * * @param string $path * @return string */ public function resourcePath($path = '') { return $this->joinPaths($this->basePath('resources'), $path); } /** * Get the path to the views directory. * * This method returns the first configured path in the array of view paths. * * @param string $path * @return string */ public function viewPath($path = '') { $viewPath = rtrim($this['config']->get('view.paths')[0], DIRECTORY_SEPARATOR); return $this->joinPaths($viewPath, $path); } /** * Join the given paths together. * * @param string $basePath * @param string $path * @return string */ public function joinPaths($basePath, $path = '') { return join_paths($basePath, $path); } /** * Get the path to the environment file directory. * * @return string */ public function environmentPath() { return $this->environmentPath ?: $this->basePath; } /** * Set the directory for the environment file. * * @param string $path * @return $this */ public function useEnvironmentPath($path) { $this->environmentPath = $path; return $this; } /** * Set the environment file to be loaded during bootstrapping. * * @param string $file * @return $this */ public function loadEnvironmentFrom($file) { $this->environmentFile = $file; return $this; } /** * Get the environment file the application is using. * * @return string */ public function environmentFile() { return $this->environmentFile ?: '.env'; } /** * Get the fully qualified path to the environment file. * * @return string */ public function environmentFilePath() { return $this->environmentPath().DIRECTORY_SEPARATOR.$this->environmentFile(); } /** * Get or check the current application environment. * * @param string|array ...$environments * @return string|bool */ public function environment(...$environments) { if (count($environments) > 0) { $patterns = is_array($environments[0]) ? $environments[0] : $environments; return Str::is($patterns, $this['env']); } return $this['env']; } /** * Determine if the application is in the local environment. * * @return bool */ public function isLocal() { return $this['env'] === 'local'; } /** * Determine if the application is in the production environment. * * @return bool */ public function isProduction() { return $this['env'] === 'production'; } /** * Detect the application's current environment. * * @param \Closure $callback * @return string */ public function detectEnvironment(Closure $callback) { $args = $this->runningInConsole() && isset($_SERVER['argv']) ? $_SERVER['argv'] : null; return $this['env'] = (new EnvironmentDetector)->detect($callback, $args); } /** * Determine if the application is running in the console. * * @return bool */ public function runningInConsole() { if ($this->isRunningInConsole === null) { $this->isRunningInConsole = Env::get('APP_RUNNING_IN_CONSOLE') ?? (\PHP_SAPI === 'cli' || \PHP_SAPI === 'phpdbg'); } return $this->isRunningInConsole; } /** * Determine if the application is running any of the given console commands. * * @param string|array ...$commands * @return bool */ public function runningConsoleCommand(...$commands) { if (! $this->runningInConsole()) { return false; } return in_array( $_SERVER['argv'][1] ?? null, is_array($commands[0]) ? $commands[0] : $commands ); } /** * Determine if the application is running unit tests. * * @return bool */ public function runningUnitTests() { return $this->bound('env') && $this['env'] === 'testing'; } /** * Determine if the application is running with debug mode enabled. * * @return bool */ public function hasDebugModeEnabled() { return (bool) $this['config']->get('app.debug'); } /** * Register all of the configured providers. * * @return void */ public function registerConfiguredProviders() { $providers = Collection::make($this->make('config')->get('app.providers')) ->partition(fn ($provider) => str_starts_with($provider, 'Illuminate\\')); $providers->splice(1, 0, [$this->make(PackageManifest::class)->providers()]); (new ProviderRepository($this, new Filesystem, $this->getCachedServicesPath())) ->load($providers->collapse()->toArray()); } /** * Register a service provider with the application. * * @param \Illuminate\Support\ServiceProvider|string $provider * @param bool $force * @return \Illuminate\Support\ServiceProvider */ public function register($provider, $force = false) { if (($registered = $this->getProvider($provider)) && ! $force) { return $registered; } // If the given "provider" is a string, we will resolve it, passing in the // application instance automatically for the developer. This is simply // a more convenient way of specifying your service provider classes. if (is_string($provider)) { $provider = $this->resolveProvider($provider); } $provider->register(); // If there are bindings / singletons set as properties on the provider we // will spin through them and register them with the application, which // serves as a convenience layer while registering a lot of bindings. if (property_exists($provider, 'bindings')) { foreach ($provider->bindings as $key => $value) { $this->bind($key, $value); } } if (property_exists($provider, 'singletons')) { foreach ($provider->singletons as $key => $value) { $key = is_int($key) ? $value : $key; $this->singleton($key, $value); } } $this->markAsRegistered($provider); // If the application has already booted, we will call this boot method on // the provider class so it has an opportunity to do its boot logic and // will be ready for any usage by this developer's application logic. if ($this->isBooted()) { $this->bootProvider($provider); } return $provider; } /** * Get the registered service provider instance if it exists. * * @param \Illuminate\Support\ServiceProvider|string $provider * @return \Illuminate\Support\ServiceProvider|null */ public function getProvider($provider) { return array_values($this->getProviders($provider))[0] ?? null; } /** * Get the registered service provider instances if any exist. * * @param \Illuminate\Support\ServiceProvider|string $provider * @return array */ public function getProviders($provider) { $name = is_string($provider) ? $provider : get_class($provider); return Arr::where($this->serviceProviders, fn ($value) => $value instanceof $name); } /** * Resolve a service provider instance from the class name. * * @param string $provider * @return \Illuminate\Support\ServiceProvider */ public function resolveProvider($provider) { return new $provider($this); } /** * Mark the given provider as registered. * * @param \Illuminate\Support\ServiceProvider $provider * @return void */ protected function markAsRegistered($provider) { $this->serviceProviders[] = $provider; $this->loadedProviders[get_class($provider)] = true; } /** * Load and boot all of the remaining deferred providers. * * @return void */ public function loadDeferredProviders() { // We will simply spin through each of the deferred providers and register each // one and boot them if the application has booted. This should make each of // the remaining services available to this application for immediate use. foreach ($this->deferredServices as $service => $provider) { $this->loadDeferredProvider($service); } $this->deferredServices = []; } /** * Load the provider for a deferred service. * * @param string $service * @return void */ public function loadDeferredProvider($service) { if (! $this->isDeferredService($service)) { return; } $provider = $this->deferredServices[$service]; // If the service provider has not already been loaded and registered we can // register it with the application and remove the service from this list // of deferred services, since it will already be loaded on subsequent. if (! isset($this->loadedProviders[$provider])) { $this->registerDeferredProvider($provider, $service); } } /** * Register a deferred provider and service. * * @param string $provider * @param string|null $service * @return void */ public function registerDeferredProvider($provider, $service = null) { // Once the provider that provides the deferred service has been registered we // will remove it from our local list of the deferred services with related // providers so that this container does not try to resolve it out again. if ($service) { unset($this->deferredServices[$service]); } $this->register($instance = new $provider($this)); if (! $this->isBooted()) { $this->booting(function () use ($instance) { $this->bootProvider($instance); }); } } /** * Resolve the given type from the container. * * @param string $abstract * @param array $parameters * @return mixed */ public function make($abstract, array $parameters = []) { $this->loadDeferredProviderIfNeeded($abstract = $this->getAlias($abstract)); return parent::make($abstract, $parameters); } /** * Resolve the given type from the container. * * @param string $abstract * @param array $parameters * @param bool $raiseEvents * @return mixed */ protected function resolve($abstract, $parameters = [], $raiseEvents = true) { $this->loadDeferredProviderIfNeeded($abstract = $this->getAlias($abstract)); return parent::resolve($abstract, $parameters, $raiseEvents); } /** * Load the deferred provider if the given type is a deferred service and the instance has not been loaded. * * @param string $abstract * @return void */ protected function loadDeferredProviderIfNeeded($abstract) { if ($this->isDeferredService($abstract) && ! isset($this->instances[$abstract])) { $this->loadDeferredProvider($abstract); } } /** * Determine if the given abstract type has been bound. * * @param string $abstract * @return bool */ public function bound($abstract) { return $this->isDeferredService($abstract) || parent::bound($abstract); } /** * Determine if the application has booted. * * @return bool */ public function isBooted() { return $this->booted; } /** * Boot the application's service providers. * * @return void */ public function boot() { if ($this->isBooted()) { return; } // Once the application has booted we will also fire some "booted" callbacks // for any listeners that need to do work after this initial booting gets // finished. This is useful when ordering the boot-up processes we run. $this->fireAppCallbacks($this->bootingCallbacks); array_walk($this->serviceProviders, function ($p) { $this->bootProvider($p); }); $this->booted = true; $this->fireAppCallbacks($this->bootedCallbacks); } /** * Boot the given service provider. * * @param \Illuminate\Support\ServiceProvider $provider * @return void */ protected function bootProvider(ServiceProvider $provider) { $provider->callBootingCallbacks(); if (method_exists($provider, 'boot')) { $this->call([$provider, 'boot']); } $provider->callBootedCallbacks(); } /** * Register a new boot listener. * * @param callable $callback * @return void */ public function booting($callback) { $this->bootingCallbacks[] = $callback; } /** * Register a new "booted" listener. * * @param callable $callback * @return void */ public function booted($callback) { $this->bootedCallbacks[] = $callback; if ($this->isBooted()) { $callback($this); } } /** * Call the booting callbacks for the application. * * @param callable[] $callbacks * @return void */ protected function fireAppCallbacks(array &$callbacks) { $index = 0; while ($index < count($callbacks)) { $callbacks[$index]($this); $index++; } } /** * {@inheritdoc} * * @return \Symfony\Component\HttpFoundation\Response */ public function handle(SymfonyRequest $request, int $type = self::MAIN_REQUEST, bool $catch = true): SymfonyResponse { return $this[HttpKernelContract::class]->handle(Request::createFromBase($request)); } /** * Determine if middleware has been disabled for the application. * * @return bool */ public function shouldSkipMiddleware() { return $this->bound('middleware.disable') && $this->make('middleware.disable') === true; } /** * Get the path to the cached services.php file. * * @return string */ public function getCachedServicesPath() { return $this->normalizeCachePath('APP_SERVICES_CACHE', 'cache/services.php'); } /** * Get the path to the cached packages.php file. * * @return string */ public function getCachedPackagesPath() { return $this->normalizeCachePath('APP_PACKAGES_CACHE', 'cache/packages.php'); } /** * Determine if the application configuration is cached. * * @return bool */ public function configurationIsCached() { return is_file($this->getCachedConfigPath()); } /** * Get the path to the configuration cache file. * * @return string */ public function getCachedConfigPath() { return $this->normalizeCachePath('APP_CONFIG_CACHE', 'cache/config.php'); } /** * Determine if the application routes are cached. * * @return bool */ public function routesAreCached() { return $this['files']->exists($this->getCachedRoutesPath()); } /** * Get the path to the routes cache file. * * @return string */ public function getCachedRoutesPath() { return $this->normalizeCachePath('APP_ROUTES_CACHE', 'cache/routes-v7.php'); } /** * Determine if the application events are cached. * * @return bool */ public function eventsAreCached() { return $this['files']->exists($this->getCachedEventsPath()); } /** * Get the path to the events cache file. * * @return string */ public function getCachedEventsPath() { return $this->normalizeCachePath('APP_EVENTS_CACHE', 'cache/events.php'); } /** * Normalize a relative or absolute path to a cache file. * * @param string $key * @param string $default * @return string */ protected function normalizeCachePath($key, $default) { if (is_null($env = Env::get($key))) { return $this->bootstrapPath($default); } return Str::startsWith($env, $this->absoluteCachePathPrefixes) ? $env : $this->basePath($env); } /** * Add new prefix to list of absolute path prefixes. * * @param string $prefix * @return $this */ public function addAbsoluteCachePathPrefix($prefix) { $this->absoluteCachePathPrefixes[] = $prefix; return $this; } /** * Get an instance of the maintenance mode manager implementation. * * @return \Illuminate\Contracts\Foundation\MaintenanceMode */ public function maintenanceMode() { return $this->make(MaintenanceModeContract::class); } /** * Determine if the application is currently down for maintenance. * * @return bool */ public function isDownForMaintenance() { return $this->maintenanceMode()->active(); } /** * Throw an HttpException with the given data. * * @param int $code * @param string $message * @param array $headers * @return never * * @throws \Symfony\Component\HttpKernel\Exception\HttpException * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public function abort($code, $message = '', array $headers = []) { if ($code == 404) { throw new NotFoundHttpException($message, null, 0, $headers); } throw new HttpException($code, $message, null, $headers); } /** * Register a terminating callback with the application. * * @param callable|string $callback * @return $this */ public function terminating($callback) { $this->terminatingCallbacks[] = $callback; return $this; } /** * Terminate the application. * * @return void */ public function terminate() { $index = 0; while ($index < count($this->terminatingCallbacks)) { $this->call($this->terminatingCallbacks[$index]); $index++; } } /** * Get the service providers that have been loaded. * * @return array */ public function getLoadedProviders() { return $this->loadedProviders; } /** * Determine if the given service provider is loaded. * * @param string $provider * @return bool */ public function providerIsLoaded(string $provider) { return isset($this->loadedProviders[$provider]); } /** * Get the application's deferred services. * * @return array */ public function getDeferredServices() { return $this->deferredServices; } /** * Set the application's deferred services. * * @param array $services * @return void */ public function setDeferredServices(array $services) { $this->deferredServices = $services; } /** * Add an array of services to the application's deferred services. * * @param array $services * @return void */ public function addDeferredServices(array $services) { $this->deferredServices = array_merge($this->deferredServices, $services); } /** * Determine if the given service is a deferred service. * * @param string $service * @return bool */ public function isDeferredService($service) { return isset($this->deferredServices[$service]); } /** * Configure the real-time facade namespace. * * @param string $namespace * @return void */ public function provideFacades($namespace) { AliasLoader::setFacadeNamespace($namespace); } /** * Get the current application locale. * * @return string */ public function getLocale() { return $this['config']->get('app.locale'); } /** * Get the current application locale. * * @return string */ public function currentLocale() { return $this->getLocale(); } /** * Get the current application fallback locale. * * @return string */ public function getFallbackLocale() { return $this['config']->get('app.fallback_locale'); } /** * Set the current application locale. * * @param string $locale * @return void */ public function setLocale($locale) { $this['config']->set('app.locale', $locale); $this['translator']->setLocale($locale); $this['events']->dispatch(new LocaleUpdated($locale)); } /** * Set the current application fallback locale. * * @param string $fallbackLocale * @return void */ public function setFallbackLocale($fallbackLocale) { $this['config']->set('app.fallback_locale', $fallbackLocale); $this['translator']->setFallback($fallbackLocale); } /** * Determine if the application locale is the given locale. * * @param string $locale * @return bool */ public function isLocale($locale) { return $this->getLocale() == $locale; } /** * Register the core class aliases in the container. * * @return void */ public function registerCoreContainerAliases() { foreach ([ 'app' => [self::class, \Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class, \Psr\Container\ContainerInterface::class], 'auth' => [\Illuminate\Auth\AuthManager::class, \Illuminate\Contracts\Auth\Factory::class], 'auth.driver' => [\Illuminate\Contracts\Auth\Guard::class], 'blade.compiler' => [\Illuminate\View\Compilers\BladeCompiler::class], 'cache' => [\Illuminate\Cache\CacheManager::class, \Illuminate\Contracts\Cache\Factory::class], 'cache.store' => [\Illuminate\Cache\Repository::class, \Illuminate\Contracts\Cache\Repository::class, \Psr\SimpleCache\CacheInterface::class], 'cache.psr6' => [\Symfony\Component\Cache\Adapter\Psr16Adapter::class, \Symfony\Component\Cache\Adapter\AdapterInterface::class, \Psr\Cache\CacheItemPoolInterface::class], 'config' => [\Illuminate\Config\Repository::class, \Illuminate\Contracts\Config\Repository::class], 'cookie' => [\Illuminate\Cookie\CookieJar::class, \Illuminate\Contracts\Cookie\Factory::class, \Illuminate\Contracts\Cookie\QueueingFactory::class], 'db' => [\Illuminate\Database\DatabaseManager::class, \Illuminate\Database\ConnectionResolverInterface::class], 'db.connection' => [\Illuminate\Database\Connection::class, \Illuminate\Database\ConnectionInterface::class], 'db.schema' => [\Illuminate\Database\Schema\Builder::class], 'encrypter' => [\Illuminate\Encryption\Encrypter::class, \Illuminate\Contracts\Encryption\Encrypter::class, \Illuminate\Contracts\Encryption\StringEncrypter::class], 'events' => [\Illuminate\Events\Dispatcher::class, \Illuminate\Contracts\Events\Dispatcher::class], 'files' => [\Illuminate\Filesystem\Filesystem::class], 'filesystem' => [\Illuminate\Filesystem\FilesystemManager::class, \Illuminate\Contracts\Filesystem\Factory::class], 'filesystem.disk' => [\Illuminate\Contracts\Filesystem\Filesystem::class], 'filesystem.cloud' => [\Illuminate\Contracts\Filesystem\Cloud::class], 'hash' => [\Illuminate\Hashing\HashManager::class], 'hash.driver' => [\Illuminate\Contracts\Hashing\Hasher::class], 'translator' => [\Illuminate\Translation\Translator::class, \Illuminate\Contracts\Translation\Translator::class], 'log' => [\Illuminate\Log\LogManager::class, \Psr\Log\LoggerInterface::class], 'mail.manager' => [\Illuminate\Mail\MailManager::class, \Illuminate\Contracts\Mail\Factory::class], 'mailer' => [\Illuminate\Mail\Mailer::class, \Illuminate\Contracts\Mail\Mailer::class, \Illuminate\Contracts\Mail\MailQueue::class], 'auth.password' => [\Illuminate\Auth\Passwords\PasswordBrokerManager::class, \Illuminate\Contracts\Auth\PasswordBrokerFactory::class], 'auth.password.broker' => [\Illuminate\Auth\Passwords\PasswordBroker::class, \Illuminate\Contracts\Auth\PasswordBroker::class], 'queue' => [\Illuminate\Queue\QueueManager::class, \Illuminate\Contracts\Queue\Factory::class, \Illuminate\Contracts\Queue\Monitor::class], 'queue.connection' => [\Illuminate\Contracts\Queue\Queue::class], 'queue.failer' => [\Illuminate\Queue\Failed\FailedJobProviderInterface::class], 'redirect' => [\Illuminate\Routing\Redirector::class], 'redis' => [\Illuminate\Redis\RedisManager::class, \Illuminate\Contracts\Redis\Factory::class], 'redis.connection' => [\Illuminate\Redis\Connections\Connection::class, \Illuminate\Contracts\Redis\Connection::class], 'request' => [\Illuminate\Http\Request::class, \Symfony\Component\HttpFoundation\Request::class], 'router' => [\Illuminate\Routing\Router::class, \Illuminate\Contracts\Routing\Registrar::class, \Illuminate\Contracts\Routing\BindingRegistrar::class], 'session' => [\Illuminate\Session\SessionManager::class], 'session.store' => [\Illuminate\Session\Store::class, \Illuminate\Contracts\Session\Session::class], 'url' => [\Illuminate\Routing\UrlGenerator::class, \Illuminate\Contracts\Routing\UrlGenerator::class], 'validator' => [\Illuminate\Validation\Factory::class, \Illuminate\Contracts\Validation\Factory::class], 'view' => [\Illuminate\View\Factory::class, \Illuminate\Contracts\View\Factory::class], ] as $key => $aliases) { foreach ($aliases as $alias) { $this->alias($key, $alias); } } } /** * Flush the container of all bindings and resolved instances. * * @return void */ public function flush() { parent::flush(); $this->buildStack = []; $this->loadedProviders = []; $this->bootedCallbacks = []; $this->bootingCallbacks = []; $this->deferredServices = []; $this->reboundCallbacks = []; $this->serviceProviders = []; $this->resolvingCallbacks = []; $this->terminatingCallbacks = []; $this->beforeResolvingCallbacks = []; $this->afterResolvingCallbacks = []; $this->globalBeforeResolvingCallbacks = []; $this->globalResolvingCallbacks = []; $this->globalAfterResolvingCallbacks = []; } /** * Get the application namespace. * * @return string * * @throws \RuntimeException */ public function getNamespace() { if (! is_null($this->namespace)) { return $this->namespace; } $composer = json_decode(file_get_contents($this->basePath('composer.json')), true); foreach ((array) data_get($composer, 'autoload.psr-4') as $namespace => $path) { foreach ((array) $path as $pathChoice) { if (realpath($this->path()) === realpath($this->basePath($pathChoice))) { return $this->namespace = $namespace; } } } throw new RuntimeException('Unable to detect application namespace.'); } } PKO$W]éÔ*00+src/Illuminate/Foundation/stubs/facade.stubnu„[µü¤detectConsoleEnvironment($callback, $consoleArgs); } return $this->detectWebEnvironment($callback); } /** * Set the application environment for a web request. * * @param \Closure $callback * @return string */ protected function detectWebEnvironment(Closure $callback) { return $callback(); } /** * Set the application environment from command-line arguments. * * @param \Closure $callback * @param array $args * @return string */ protected function detectConsoleEnvironment(Closure $callback, array $args) { // First we will check if an environment argument was passed via console arguments // and if it was that automatically overrides as the environment. Otherwise, we // will check the environment as a "web" request like a typical HTTP request. if (! is_null($value = $this->getEnvironmentArgument($args))) { return $value; } return $this->detectWebEnvironment($callback); } /** * Get the environment argument from the console. * * @param array $args * @return string|null */ protected function getEnvironmentArgument(array $args) { foreach ($args as $i => $value) { if ($value === '--env') { return $args[$i + 1] ?? null; } if (str_starts_with($value, '--env=')) { return head(array_slice(explode('=', $value), 1)); } } } } PKO$W]×øÖAŽŽ6src/Illuminate/Foundation/FileBasedMaintenanceMode.phpnu„[µü¤path(), json_encode($payload, JSON_PRETTY_PRINT) ); } /** * Take the application out of maintenance. * * @return void */ public function deactivate(): void { if ($this->active()) { unlink($this->path()); } } /** * Determine if the application is currently down for maintenance. * * @return bool */ public function active(): bool { return file_exists($this->path()); } /** * Get the data array which was provided when the application was placed into maintenance. * * @return array */ public function data(): array { return json_decode(file_get_contents($this->path()), true); } /** * Get the path where the file is stored that signals that the application is down for maintenance. * * @return string */ protected function path(): string { return storage_path('framework/down'); } } PKO$W]ÓêMee:src/Illuminate/Foundation/Testing/RefreshDatabaseState.phpnu„[µü¤beforeRefreshingDatabase(); $this->refreshTestDatabase(); $this->afterRefreshingDatabase(); $this->beforeApplicationDestroyed(function () { $this->artisan('migrate:rollback'); RefreshDatabaseState::$migrated = false; }); } /** * Refresh a conventional test database. * * @return void */ protected function refreshTestDatabase() { $this->artisan('migrate:fresh', $this->migrateFreshUsing()); $this->app[Kernel::class]->setArtisan(null); } /** * Perform any work that should take place before the database has started refreshing. * * @return void */ protected function beforeRefreshingDatabase() { // ... } /** * Perform any work that should take place once the database has finished refreshing. * * @return void */ protected function afterRefreshingDatabase() { // ... } } PKO$W]+M‘ÈÈ3src/Illuminate/Foundation/Testing/WithoutEvents.phpnu„[µü¤withoutEvents(); } else { throw new Exception('Unable to disable events. ApplicationTrait not used.'); } } } PKO$W]!  ,ïï5src/Illuminate/Foundation/Testing/RefreshDatabase.phpnu„[µü¤beforeRefreshingDatabase(); $this->usingInMemoryDatabase() ? $this->refreshInMemoryDatabase() : $this->refreshTestDatabase(); $this->afterRefreshingDatabase(); } /** * Determine if an in-memory database is being used. * * @return bool */ protected function usingInMemoryDatabase() { $default = config('database.default'); return config("database.connections.$default.database") === ':memory:'; } /** * Refresh the in-memory database. * * @return void */ protected function refreshInMemoryDatabase() { $this->artisan('migrate', $this->migrateUsing()); $this->app[Kernel::class]->setArtisan(null); } /** * The parameters that should be used when running "migrate". * * @return array */ protected function migrateUsing() { return [ '--seed' => $this->shouldSeed(), '--seeder' => $this->seeder(), ]; } /** * Refresh a conventional test database. * * @return void */ protected function refreshTestDatabase() { if (! RefreshDatabaseState::$migrated) { $this->artisan('migrate:fresh', $this->migrateFreshUsing()); $this->app[Kernel::class]->setArtisan(null); RefreshDatabaseState::$migrated = true; } $this->beginDatabaseTransaction(); } /** * Begin a database transaction on the testing database. * * @return void */ public function beginDatabaseTransaction() { $database = $this->app->make('db'); $this->app->instance('db.transactions', $transactionsManager = new DatabaseTransactionsManager); foreach ($this->connectionsToTransact() as $name) { $connection = $database->connection($name); $connection->setTransactionManager($transactionsManager); $dispatcher = $connection->getEventDispatcher(); $connection->unsetEventDispatcher(); $connection->beginTransaction(); $connection->setEventDispatcher($dispatcher); } $this->beforeApplicationDestroyed(function () use ($database) { foreach ($this->connectionsToTransact() as $name) { $connection = $database->connection($name); $dispatcher = $connection->getEventDispatcher(); $connection->unsetEventDispatcher(); $connection->rollBack(); $connection->setEventDispatcher($dispatcher); $connection->disconnect(); } }); } /** * The database connections that should have transactions. * * @return array */ protected function connectionsToTransact() { return property_exists($this, 'connectionsToTransact') ? $this->connectionsToTransact : [null]; } /** * Perform any work that should take place before the database has started refreshing. * * @return void */ protected function beforeRefreshingDatabase() { // ... } /** * Perform any work that should take place once the database has finished refreshing. * * @return void */ protected function afterRefreshingDatabase() { // ... } } PKO$W]0ñ¡<<:src/Illuminate/Foundation/Testing/DatabaseTransactions.phpnu„[µü¤app->make('db'); $this->app->instance('db.transactions', $transactionsManager = new DatabaseTransactionsManager); foreach ($this->connectionsToTransact() as $name) { $connection = $database->connection($name); $connection->setTransactionManager($transactionsManager); $dispatcher = $connection->getEventDispatcher(); $connection->unsetEventDispatcher(); $connection->beginTransaction(); $connection->setEventDispatcher($dispatcher); } $this->beforeApplicationDestroyed(function () use ($database) { foreach ($this->connectionsToTransact() as $name) { $connection = $database->connection($name); $dispatcher = $connection->getEventDispatcher(); $connection->unsetEventDispatcher(); $connection->rollBack(); $connection->setEventDispatcher($dispatcher); $connection->disconnect(); } }); } /** * The database connections that should have transactions. * * @return array */ protected function connectionsToTransact() { return property_exists($this, 'connectionsToTransact') ? $this->connectionsToTransact : [null]; } } PKO$W]ÜÁ©ýôô7src/Illuminate/Foundation/Testing/WithoutMiddleware.phpnu„[µü¤withoutMiddleware(); } else { throw new Exception('Unable to disable middleware. MakesHttpRequests trait not used.'); } } } PKO$W]ò¢Òû¹¹.src/Illuminate/Foundation/Testing/TestCase.phpnu„[µü¤setUpTheTestEnvironment(); } /** * Refresh the application instance. * * @return void */ protected function refreshApplication() { $this->app = $this->createApplication(); } /** * {@inheritdoc} */ protected function runTest(): mixed { $result = null; try { // @phpstan-ignore-next-line $result = parent::runTest(); } catch (Throwable $e) { if (! is_null(static::$latestResponse)) { static::$latestResponse->transformNotSuccessfulException($e); } throw $e; } return $result; } /** * Clean up the testing environment before the next test. * * @return void * * @throws \Mockery\Exception\InvalidCountException */ protected function tearDown(): void { $this->tearDownTheTestEnvironment(); } /** * Clean up the testing environment before the next test case. * * @return void */ public static function tearDownAfterClass(): void { static::$latestResponse = null; static::tearDownAfterClassUsingTestCase(); } } PKO$W]‹|²cUUMsrc/Illuminate/Foundation/Testing/Concerns/InteractsWithTestCaseLifecycle.phpnu„[µü¤app) { $this->refreshApplication(); ParallelTesting::callSetUpTestCaseCallbacks($this); } $this->setUpTraits(); foreach ($this->afterApplicationCreatedCallbacks as $callback) { $callback(); } Model::setEventDispatcher($this->app['events']); $this->setUpHasRun = true; } /** * Clean up the testing environment before the next test. * * @internal * * @return void */ protected function tearDownTheTestEnvironment(): void { if ($this->app) { $this->callBeforeApplicationDestroyedCallbacks(); ParallelTesting::callTearDownTestCaseCallbacks($this); $this->app->flush(); $this->app = null; } $this->setUpHasRun = false; if (property_exists($this, 'serverVariables')) { $this->serverVariables = []; } if (property_exists($this, 'defaultHeaders')) { $this->defaultHeaders = []; } if (class_exists('Mockery')) { if ($container = Mockery::getContainer()) { $this->addToAssertionCount($container->mockery_getExpectationCount()); } try { Mockery::close(); } catch (InvalidCountException $e) { if (! Str::contains($e->getMethodName(), ['doWrite', 'askQuestion'])) { throw $e; } } } if (class_exists(Carbon::class)) { Carbon::setTestNow(); } if (class_exists(CarbonImmutable::class)) { CarbonImmutable::setTestNow(); } $this->afterApplicationCreatedCallbacks = []; $this->beforeApplicationDestroyedCallbacks = []; if (property_exists($this, 'originalExceptionHandler')) { $this->originalExceptionHandler = null; } if (property_exists($this, 'originalDeprecationHandler')) { $this->originalDeprecationHandler = null; } AboutCommand::flushState(); Artisan::forgetBootstrappers(); Component::flushCache(); Component::forgetComponentsResolver(); Component::forgetFactory(); ConvertEmptyStringsToNull::flushState(); HandleExceptions::forgetApp(); Queue::createPayloadUsing(null); Sleep::fake(false); TrimStrings::flushState(); if ($this->callbackException) { throw $this->callbackException; } } /** * Boot the testing helper traits. * * @return array */ protected function setUpTraits() { $uses = array_flip(class_uses_recursive(static::class)); if (isset($uses[RefreshDatabase::class])) { $this->refreshDatabase(); } if (isset($uses[DatabaseMigrations::class])) { $this->runDatabaseMigrations(); } if (isset($uses[DatabaseTruncation::class])) { $this->truncateDatabaseTables(); } if (isset($uses[DatabaseTransactions::class])) { $this->beginDatabaseTransaction(); } if (isset($uses[WithoutMiddleware::class])) { $this->disableMiddlewareForAllTests(); } if (isset($uses[WithoutEvents::class])) { $this->disableEventsForAllTests(); } if (isset($uses[WithFaker::class])) { $this->setUpFaker(); } foreach ($uses as $trait) { if (method_exists($this, $method = 'setUp'.class_basename($trait))) { $this->{$method}(); } if (method_exists($this, $method = 'tearDown'.class_basename($trait))) { $this->beforeApplicationDestroyed(fn () => $this->{$method}()); } } return $uses; } /** * Clean up the testing environment before the next test case. * * @internal * * @return void */ public static function tearDownAfterClassUsingTestCase() { foreach ([ \PHPUnit\Util\Annotation\Registry::class, \PHPUnit\Metadata\Annotation\Parser\Registry::class, ] as $class) { if (class_exists($class)) { (function () { $this->classDocBlocks = []; $this->methodDocBlocks = []; })->call($class::getInstance()); } } } /** * Register a callback to be run after the application is created. * * @param callable $callback * @return void */ public function afterApplicationCreated(callable $callback) { $this->afterApplicationCreatedCallbacks[] = $callback; if ($this->setUpHasRun) { $callback(); } } /** * Register a callback to be run before the application is destroyed. * * @param callable $callback * @return void */ protected function beforeApplicationDestroyed(callable $callback) { $this->beforeApplicationDestroyedCallbacks[] = $callback; } /** * Execute the application's pre-destruction callbacks. * * @return void */ protected function callBeforeApplicationDestroyedCallbacks() { foreach ($this->beforeApplicationDestroyedCallbacks as $callback) { try { $callback(); } catch (Throwable $e) { if (! $this->callbackException) { $this->callbackException = $e; } } } } } PKO$W]›Tµ¦úú@src/Illuminate/Foundation/Testing/Concerns/InteractsWithTime.phpnu„[µü¤travelTo(Carbon::now(), $callback); } /** * Freeze time at the beginning of the current second. * * @param callable|null $callback * @return mixed */ public function freezeSecond($callback = null) { return $this->travelTo(Carbon::now()->startOfSecond(), $callback); } /** * Begin travelling to another time. * * @param int $value * @return \Illuminate\Foundation\Testing\Wormhole */ public function travel($value) { return new Wormhole($value); } /** * Travel to another time. * * @param \DateTimeInterface|\Closure|\Illuminate\Support\Carbon|string|bool|null $date * @param callable|null $callback * @return mixed */ public function travelTo($date, $callback = null) { Carbon::setTestNow($date); if ($callback) { return tap($callback($date), function () { Carbon::setTestNow(); }); } } /** * Travel back to the current time. * * @return \DateTimeInterface */ public function travelBack() { return Wormhole::back(); } } PKO$W]0ì)}~~Csrc/Illuminate/Foundation/Testing/Concerns/InteractsWithSession.phpnu„[µü¤session($data); return $this; } /** * Set the session to the given array. * * @param array $data * @return $this */ public function session(array $data) { $this->startSession(); foreach ($data as $key => $value) { $this->app['session']->put($key, $value); } return $this; } /** * Start the session for the application. * * @return $this */ protected function startSession() { if (! $this->app['session']->isStarted()) { $this->app['session']->start(); } return $this; } /** * Flush all of the current session data. * * @return $this */ public function flushSession() { $this->startSession(); $this->app['session']->flush(); return $this; } } PKO$W]ª§C®®Jsrc/Illuminate/Foundation/Testing/Concerns/InteractsWithAuthentication.phpnu„[µü¤be($user, $guard); } /** * Set the currently logged in user for the application. * * @param \Illuminate\Contracts\Auth\Authenticatable $user * @param string|null $guard * @return $this */ public function be(UserContract $user, $guard = null) { if (isset($user->wasRecentlyCreated) && $user->wasRecentlyCreated) { $user->wasRecentlyCreated = false; } $this->app['auth']->guard($guard)->setUser($user); $this->app['auth']->shouldUse($guard); return $this; } /** * Assert that the user is authenticated. * * @param string|null $guard * @return $this */ public function assertAuthenticated($guard = null) { $this->assertTrue($this->isAuthenticated($guard), 'The user is not authenticated'); return $this; } /** * Assert that the user is not authenticated. * * @param string|null $guard * @return $this */ public function assertGuest($guard = null) { $this->assertFalse($this->isAuthenticated($guard), 'The user is authenticated'); return $this; } /** * Return true if the user is authenticated, false otherwise. * * @param string|null $guard * @return bool */ protected function isAuthenticated($guard = null) { return $this->app->make('auth')->guard($guard)->check(); } /** * Assert that the user is authenticated as the given user. * * @param \Illuminate\Contracts\Auth\Authenticatable $user * @param string|null $guard * @return $this */ public function assertAuthenticatedAs($user, $guard = null) { $expected = $this->app->make('auth')->guard($guard)->user(); $this->assertNotNull($expected, 'The current user is not authenticated.'); $this->assertInstanceOf( get_class($expected), $user, 'The currently authenticated user is not who was expected' ); $this->assertSame( $expected->getAuthIdentifier(), $user->getAuthIdentifier(), 'The currently authenticated user is not who was expected' ); return $this; } /** * Assert that the given credentials are valid. * * @param array $credentials * @param string|null $guard * @return $this */ public function assertCredentials(array $credentials, $guard = null) { $this->assertTrue( $this->hasCredentials($credentials, $guard), 'The given credentials are invalid.' ); return $this; } /** * Assert that the given credentials are invalid. * * @param array $credentials * @param string|null $guard * @return $this */ public function assertInvalidCredentials(array $credentials, $guard = null) { $this->assertFalse( $this->hasCredentials($credentials, $guard), 'The given credentials are valid.' ); return $this; } /** * Return true if the credentials are valid, false otherwise. * * @param array $credentials * @param string|null $guard * @return bool */ protected function hasCredentials(array $credentials, $guard = null) { $provider = $this->app->make('auth')->guard($guard)->getProvider(); $user = $provider->retrieveByCredentials($credentials); return $user && $provider->validateCredentials($user, $credentials); } } PKO$W]Ê«ˆíIIEsrc/Illuminate/Foundation/Testing/Concerns/InteractsWithContainer.phpnu„[µü¤instance($abstract, $instance); } /** * Register an instance of an object in the container. * * @param string $abstract * @param object $instance * @return object */ protected function instance($abstract, $instance) { $this->app->instance($abstract, $instance); return $instance; } /** * Mock an instance of an object in the container. * * @param string $abstract * @param \Closure|null $mock * @return \Mockery\MockInterface */ protected function mock($abstract, ?Closure $mock = null) { return $this->instance($abstract, Mockery::mock(...array_filter(func_get_args()))); } /** * Mock a partial instance of an object in the container. * * @param string $abstract * @param \Closure|null $mock * @return \Mockery\MockInterface */ protected function partialMock($abstract, ?Closure $mock = null) { return $this->instance($abstract, Mockery::mock(...array_filter(func_get_args()))->makePartial()); } /** * Spy an instance of an object in the container. * * @param string $abstract * @param \Closure|null $mock * @return \Mockery\MockInterface */ protected function spy($abstract, ?Closure $mock = null) { return $this->instance($abstract, Mockery::spy(...array_filter(func_get_args()))); } /** * Instruct the container to forget a previously mocked / spied instance of an object. * * @param string $abstract * @return $this */ protected function forgetMock($abstract) { $this->app->forgetInstance($abstract); return $this; } /** * Register an empty handler for Vite in the container. * * @return $this */ protected function withoutVite() { if ($this->originalVite == null) { $this->originalVite = app(Vite::class); } Facade::clearResolvedInstance(Vite::class); $this->swap(Vite::class, new class extends Vite { public function __invoke($entrypoints, $buildDirectory = null) { return new HtmlString(''); } public function __call($method, $parameters) { return ''; } public function __toString() { return ''; } public function useIntegrityKey($key) { return $this; } public function useBuildDirectory($path) { return $this; } public function useHotFile($path) { return $this; } public function withEntryPoints($entryPoints) { return $this; } public function useScriptTagAttributes($attributes) { return $this; } public function useStyleTagAttributes($attributes) { return $this; } public function usePreloadTagAttributes($attributes) { return $this; } public function preloadedAssets() { return []; } public function reactRefresh() { return ''; } public function content($asset, $buildDirectory = null) { return ''; } public function asset($asset, $buildDirectory = null) { return ''; } }); return $this; } /** * Restore Vite in the container. * * @return $this */ protected function withVite() { if ($this->originalVite) { $this->app->instance(Vite::class, $this->originalVite); } return $this; } /** * Register an empty handler for Laravel Mix in the container. * * @return $this */ protected function withoutMix() { if ($this->originalMix == null) { $this->originalMix = app(Mix::class); } $this->swap(Mix::class, function () { return new HtmlString(''); }); return $this; } /** * Restore Laravel Mix in the container. * * @return $this */ protected function withMix() { if ($this->originalMix) { $this->app->instance(Mix::class, $this->originalMix); } return $this; } } PKO$W]�½¸!!Msrc/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.phpnu„[µü¤originalExceptionHandler) { $this->app->instance(ExceptionHandler::class, $this->originalExceptionHandler); } return $this; } /** * Only handle the given exceptions via the exception handler. * * @param array $exceptions * @return $this */ protected function handleExceptions(array $exceptions) { return $this->withoutExceptionHandling($exceptions); } /** * Only handle validation exceptions via the exception handler. * * @return $this */ protected function handleValidationExceptions() { return $this->handleExceptions([ValidationException::class]); } /** * Disable exception handling for the test. * * @param array $except * @return $this */ protected function withoutExceptionHandling(array $except = []) { if ($this->originalExceptionHandler == null) { $this->originalExceptionHandler = app(ExceptionHandler::class); } $this->app->instance(ExceptionHandler::class, new class($this->originalExceptionHandler, $except) implements ExceptionHandler { protected $except; protected $originalHandler; /** * Create a new class instance. * * @param \Illuminate\Contracts\Debug\ExceptionHandler $originalHandler * @param array $except * @return void */ public function __construct($originalHandler, $except = []) { $this->except = $except; $this->originalHandler = $originalHandler; } /** * Report or log an exception. * * @param \Throwable $e * @return void * * @throws \Exception */ public function report(Throwable $e) { // } /** * Determine if the exception should be reported. * * @param \Throwable $e * @return bool */ public function shouldReport(Throwable $e) { return false; } /** * Render an exception into an HTTP response. * * @param \Illuminate\Http\Request $request * @param \Throwable $e * @return \Symfony\Component\HttpFoundation\Response * * @throws \Throwable */ public function render($request, Throwable $e) { foreach ($this->except as $class) { if ($e instanceof $class) { return $this->originalHandler->render($request, $e); } } if ($e instanceof NotFoundHttpException) { throw new NotFoundHttpException( "{$request->method()} {$request->url()}", $e, is_int($e->getCode()) ? $e->getCode() : 0 ); } throw $e; } /** * Render an exception to the console. * * @param \Symfony\Component\Console\Output\OutputInterface $output * @param \Throwable $e * @return void */ public function renderForConsole($output, Throwable $e) { (new ConsoleApplication)->renderThrowable($e, $output); } }); return $this; } /** * Assert that the given callback throws an exception with the given message when invoked. * * @param \Closure $test * @param class-string<\Throwable> $expectedClass * @param string|null $expectedMessage * @return $this */ protected function assertThrows(Closure $test, string $expectedClass = Throwable::class, ?string $expectedMessage = null) { try { $test(); $thrown = false; } catch (Throwable $exception) { $thrown = $exception instanceof $expectedClass; $actualMessage = $exception->getMessage(); } Assert::assertTrue( $thrown, sprintf('Failed asserting that exception of type "%s" was thrown.', $expectedClass) ); if (isset($expectedMessage)) { if (! isset($actualMessage)) { Assert::fail( sprintf( 'Failed asserting that exception of type "%s" with message "%s" was thrown.', $expectedClass, $expectedMessage ) ); } else { Assert::assertStringContainsString($expectedMessage, $actualMessage); } } return $this; } } PKO$W]âŠtüÍÍCsrc/Illuminate/Foundation/Testing/Concerns/InteractsWithConsole.phpnu„[µü¤mockConsoleOutput) { return $this->app[Kernel::class]->call($command, $parameters); } return new PendingCommand($this, $this->app, $command, $parameters); } /** * Disable mocking the console output. * * @return $this */ protected function withoutMockingConsoleOutput() { $this->mockConsoleOutput = false; $this->app->offsetUnset(OutputStyle::class); return $this; } } PKO$W]^¿¿ü¨¨Osrc/Illuminate/Foundation/Testing/Concerns/InteractsWithDeprecationHandling.phpnu„[µü¤originalDeprecationHandler) { set_error_handler(tap($this->originalDeprecationHandler, fn () => $this->originalDeprecationHandler = null)); } return $this; } /** * Disable deprecation handling for the test. * * @return $this */ protected function withoutDeprecationHandling() { if ($this->originalDeprecationHandler == null) { $this->originalDeprecationHandler = set_error_handler(function ($level, $message, $file = '', $line = 0) { if (in_array($level, [E_DEPRECATED, E_USER_DEPRECATED]) || (error_reporting() & $level)) { throw new ErrorException($message, 0, $level, $file, $line); } }); } return $this; } } PKO$W]6É „  Asrc/Illuminate/Foundation/Testing/Concerns/InteractsWithRedis.phpnu„[µü¤ */ private $redis; /** * Setup redis connection. * * @return void */ public function setUpRedis() { if (! extension_loaded('redis')) { $this->markTestSkipped('The redis extension is not installed. Please install the extension to enable '.__CLASS__); } if (static::$connectionFailedOnceWithDefaultsSkip) { $this->markTestSkipped('Trying default host/port failed, please set environment variable REDIS_HOST & REDIS_PORT to enable '.__CLASS__); } $app = $this->app ?? new Application; $host = Env::get('REDIS_HOST', '127.0.0.1'); $port = Env::get('REDIS_PORT', 6379); foreach (static::redisDriverProvider() as $driver) { $this->redis[$driver[0]] = new RedisManager($app, $driver[0], [ 'cluster' => false, 'options' => [ 'prefix' => 'test_', ], 'default' => [ 'host' => $host, 'port' => $port, 'database' => 5, 'timeout' => 0.5, 'name' => 'default', ], ]); } try { $this->redis['phpredis']->connection()->flushdb(); } catch (Exception) { if ($host === '127.0.0.1' && $port === 6379 && Env::get('REDIS_HOST') === null) { static::$connectionFailedOnceWithDefaultsSkip = true; $this->markTestSkipped('Trying default host/port failed, please set environment variable REDIS_HOST & REDIS_PORT to enable '.__CLASS__); } } } /** * Teardown redis connection. * * @return void */ public function tearDownRedis() { if (isset($this->redis['phpredis'])) { $this->redis['phpredis']->connection()->flushdb(); } foreach (static::redisDriverProvider() as $driver) { if (isset($this->redis[$driver[0]])) { $this->redis[$driver[0]]->connection()->disconnect(); } } } /** * Get redis driver provider. * * @return array */ public static function redisDriverProvider() { return [ ['predis'], ['phpredis'], ]; } /** * Run test if redis is available. * * @param callable $callback * @return void */ public function ifRedisAvailable($callback) { $this->setUpRedis(); $callback(); $this->tearDownRedis(); } } PKO$W]î|)*HLHL@src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.phpnu„[µü¤defaultHeaders = array_merge($this->defaultHeaders, $headers); return $this; } /** * Add a header to be sent with the request. * * @param string $name * @param string $value * @return $this */ public function withHeader(string $name, string $value) { $this->defaultHeaders[$name] = $value; return $this; } /** * Add an authorization token for the request. * * @param string $token * @param string $type * @return $this */ public function withToken(string $token, string $type = 'Bearer') { return $this->withHeader('Authorization', $type.' '.$token); } /** * Add a basic authentication header to the request with the given credentials. * * @param string $username * @param string $password * @return $this */ public function withBasicAuth(string $username, string $password) { return $this->withToken(base64_encode("$username:$password"), 'Basic'); } /** * Remove the authorization token from the request. * * @return $this */ public function withoutToken() { unset($this->defaultHeaders['Authorization']); return $this; } /** * Flush all the configured headers. * * @return $this */ public function flushHeaders() { $this->defaultHeaders = []; return $this; } /** * Define a set of server variables to be sent with the requests. * * @param array $server * @return $this */ public function withServerVariables(array $server) { $this->serverVariables = $server; return $this; } /** * Disable middleware for the test. * * @param string|array|null $middleware * @return $this */ public function withoutMiddleware($middleware = null) { if (is_null($middleware)) { $this->app->instance('middleware.disable', true); return $this; } foreach ((array) $middleware as $abstract) { $this->app->instance($abstract, new class { public function handle($request, $next) { return $next($request); } }); } return $this; } /** * Enable the given middleware for the test. * * @param string|array|null $middleware * @return $this */ public function withMiddleware($middleware = null) { if (is_null($middleware)) { unset($this->app['middleware.disable']); return $this; } foreach ((array) $middleware as $abstract) { unset($this->app[$abstract]); } return $this; } /** * Define additional cookies to be sent with the request. * * @param array $cookies * @return $this */ public function withCookies(array $cookies) { $this->defaultCookies = array_merge($this->defaultCookies, $cookies); return $this; } /** * Add a cookie to be sent with the request. * * @param string $name * @param string $value * @return $this */ public function withCookie(string $name, string $value) { $this->defaultCookies[$name] = $value; return $this; } /** * Define additional cookies will not be encrypted before sending with the request. * * @param array $cookies * @return $this */ public function withUnencryptedCookies(array $cookies) { $this->unencryptedCookies = array_merge($this->unencryptedCookies, $cookies); return $this; } /** * Add a cookie will not be encrypted before sending with the request. * * @param string $name * @param string $value * @return $this */ public function withUnencryptedCookie(string $name, string $value) { $this->unencryptedCookies[$name] = $value; return $this; } /** * Automatically follow any redirects returned from the response. * * @return $this */ public function followingRedirects() { $this->followRedirects = true; return $this; } /** * Include cookies and authorization headers for JSON requests. * * @return $this */ public function withCredentials() { $this->withCredentials = true; return $this; } /** * Disable automatic encryption of cookie values. * * @return $this */ public function disableCookieEncryption() { $this->encryptCookies = false; return $this; } /** * Set the referer header and previous URL session value from a given URL in order to simulate a previous request. * * @param string $url * @return $this */ public function from(string $url) { $this->app['session']->setPreviousUrl($url); return $this->withHeader('referer', $url); } /** * Set the referer header and previous URL session value from a given route in order to simulate a previous request. * * @param string $name * @param mixed $parameters * @return $this */ public function fromRoute(string $name, $parameters = []) { return $this->from($this->app['url']->route($name, $parameters)); } /** * Set the Precognition header to "true". * * @return $this */ public function withPrecognition() { return $this->withHeader('Precognition', 'true'); } /** * Visit the given URI with a GET request. * * @param string $uri * @param array $headers * @return \Illuminate\Testing\TestResponse */ public function get($uri, array $headers = []) { $server = $this->transformHeadersToServerVars($headers); $cookies = $this->prepareCookiesForRequest(); return $this->call('GET', $uri, [], $cookies, [], $server); } /** * Visit the given URI with a GET request, expecting a JSON response. * * @param string $uri * @param array $headers * @param int $options * @return \Illuminate\Testing\TestResponse */ public function getJson($uri, array $headers = [], $options = 0) { return $this->json('GET', $uri, [], $headers, $options); } /** * Visit the given URI with a POST request. * * @param string $uri * @param array $data * @param array $headers * @return \Illuminate\Testing\TestResponse */ public function post($uri, array $data = [], array $headers = []) { $server = $this->transformHeadersToServerVars($headers); $cookies = $this->prepareCookiesForRequest(); return $this->call('POST', $uri, $data, $cookies, [], $server); } /** * Visit the given URI with a POST request, expecting a JSON response. * * @param string $uri * @param array $data * @param array $headers * @param int $options * @return \Illuminate\Testing\TestResponse */ public function postJson($uri, array $data = [], array $headers = [], $options = 0) { return $this->json('POST', $uri, $data, $headers, $options); } /** * Visit the given URI with a PUT request. * * @param string $uri * @param array $data * @param array $headers * @return \Illuminate\Testing\TestResponse */ public function put($uri, array $data = [], array $headers = []) { $server = $this->transformHeadersToServerVars($headers); $cookies = $this->prepareCookiesForRequest(); return $this->call('PUT', $uri, $data, $cookies, [], $server); } /** * Visit the given URI with a PUT request, expecting a JSON response. * * @param string $uri * @param array $data * @param array $headers * @param int $options * @return \Illuminate\Testing\TestResponse */ public function putJson($uri, array $data = [], array $headers = [], $options = 0) { return $this->json('PUT', $uri, $data, $headers, $options); } /** * Visit the given URI with a PATCH request. * * @param string $uri * @param array $data * @param array $headers * @return \Illuminate\Testing\TestResponse */ public function patch($uri, array $data = [], array $headers = []) { $server = $this->transformHeadersToServerVars($headers); $cookies = $this->prepareCookiesForRequest(); return $this->call('PATCH', $uri, $data, $cookies, [], $server); } /** * Visit the given URI with a PATCH request, expecting a JSON response. * * @param string $uri * @param array $data * @param array $headers * @param int $options * @return \Illuminate\Testing\TestResponse */ public function patchJson($uri, array $data = [], array $headers = [], $options = 0) { return $this->json('PATCH', $uri, $data, $headers, $options); } /** * Visit the given URI with a DELETE request. * * @param string $uri * @param array $data * @param array $headers * @return \Illuminate\Testing\TestResponse */ public function delete($uri, array $data = [], array $headers = []) { $server = $this->transformHeadersToServerVars($headers); $cookies = $this->prepareCookiesForRequest(); return $this->call('DELETE', $uri, $data, $cookies, [], $server); } /** * Visit the given URI with a DELETE request, expecting a JSON response. * * @param string $uri * @param array $data * @param array $headers * @param int $options * @return \Illuminate\Testing\TestResponse */ public function deleteJson($uri, array $data = [], array $headers = [], $options = 0) { return $this->json('DELETE', $uri, $data, $headers, $options); } /** * Visit the given URI with an OPTIONS request. * * @param string $uri * @param array $data * @param array $headers * @return \Illuminate\Testing\TestResponse */ public function options($uri, array $data = [], array $headers = []) { $server = $this->transformHeadersToServerVars($headers); $cookies = $this->prepareCookiesForRequest(); return $this->call('OPTIONS', $uri, $data, $cookies, [], $server); } /** * Visit the given URI with an OPTIONS request, expecting a JSON response. * * @param string $uri * @param array $data * @param array $headers * @param int $options * @return \Illuminate\Testing\TestResponse */ public function optionsJson($uri, array $data = [], array $headers = [], $options = 0) { return $this->json('OPTIONS', $uri, $data, $headers, $options); } /** * Visit the given URI with a HEAD request. * * @param string $uri * @param array $headers * @return \Illuminate\Testing\TestResponse */ public function head($uri, array $headers = []) { $server = $this->transformHeadersToServerVars($headers); $cookies = $this->prepareCookiesForRequest(); return $this->call('HEAD', $uri, [], $cookies, [], $server); } /** * Call the given URI with a JSON request. * * @param string $method * @param string $uri * @param array $data * @param array $headers * @param int $options * @return \Illuminate\Testing\TestResponse */ public function json($method, $uri, array $data = [], array $headers = [], $options = 0) { $files = $this->extractFilesFromDataArray($data); $content = json_encode($data, $options); $headers = array_merge([ 'CONTENT_LENGTH' => mb_strlen($content, '8bit'), 'CONTENT_TYPE' => 'application/json', 'Accept' => 'application/json', ], $headers); return $this->call( $method, $uri, [], $this->prepareCookiesForJsonRequest(), $files, $this->transformHeadersToServerVars($headers), $content ); } /** * Call the given URI and return the Response. * * @param string $method * @param string $uri * @param array $parameters * @param array $cookies * @param array $files * @param array $server * @param string|null $content * @return \Illuminate\Testing\TestResponse */ public function call($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null) { $kernel = $this->app->make(HttpKernel::class); $files = array_merge($files, $this->extractFilesFromDataArray($parameters)); $symfonyRequest = SymfonyRequest::create( $this->prepareUrlForRequest($uri), $method, $parameters, $cookies, $files, array_replace($this->serverVariables, $server), $content ); $response = $kernel->handle( $request = $this->createTestRequest($symfonyRequest) ); $kernel->terminate($request, $response); if ($this->followRedirects) { $response = $this->followRedirects($response); } return static::$latestResponse = $this->createTestResponse($response); } /** * Turn the given URI into a fully qualified URL. * * @param string $uri * @return string */ protected function prepareUrlForRequest($uri) { if (str_starts_with($uri, '/')) { $uri = substr($uri, 1); } return trim(url($uri), '/'); } /** * Transform headers array to array of $_SERVER vars with HTTP_* format. * * @param array $headers * @return array */ protected function transformHeadersToServerVars(array $headers) { return collect(array_merge($this->defaultHeaders, $headers))->mapWithKeys(function ($value, $name) { $name = strtr(strtoupper($name), '-', '_'); return [$this->formatServerHeaderKey($name) => $value]; })->all(); } /** * Format the header name for the server array. * * @param string $name * @return string */ protected function formatServerHeaderKey($name) { if (! str_starts_with($name, 'HTTP_') && $name !== 'CONTENT_TYPE' && $name !== 'REMOTE_ADDR') { return 'HTTP_'.$name; } return $name; } /** * Extract the file uploads from the given data array. * * @param array $data * @return array */ protected function extractFilesFromDataArray(&$data) { $files = []; foreach ($data as $key => $value) { if ($value instanceof SymfonyUploadedFile) { $files[$key] = $value; unset($data[$key]); } if (is_array($value)) { $files[$key] = $this->extractFilesFromDataArray($value); $data[$key] = $value; } } return $files; } /** * If enabled, encrypt cookie values for request. * * @return array */ protected function prepareCookiesForRequest() { if (! $this->encryptCookies) { return array_merge($this->defaultCookies, $this->unencryptedCookies); } return collect($this->defaultCookies)->map(function ($value, $key) { return encrypt(CookieValuePrefix::create($key, app('encrypter')->getKey()).$value, false); })->merge($this->unencryptedCookies)->all(); } /** * If enabled, add cookies for JSON requests. * * @return array */ protected function prepareCookiesForJsonRequest() { return $this->withCredentials ? $this->prepareCookiesForRequest() : []; } /** * Follow a redirect chain until a non-redirect is received. * * @param \Illuminate\Http\Response|\Illuminate\Testing\TestResponse $response * @return \Illuminate\Http\Response|\Illuminate\Testing\TestResponse */ protected function followRedirects($response) { $this->followRedirects = false; while ($response->isRedirect()) { $response = $this->get($response->headers->get('Location')); } return $response; } /** * Create the request instance used for testing from the given Symfony request. * * @param \Symfony\Component\HttpFoundation\Request $symfonyRequest * @return \Illuminate\Http\Request */ protected function createTestRequest($symfonyRequest) { return Request::createFromBase($symfonyRequest); } /** * Create the test response instance from the given response. * * @param \Illuminate\Http\Response $response * @return \Illuminate\Testing\TestResponse */ protected function createTestResponse($response) { return tap(TestResponse::fromBaseResponse($response), function ($response) { $response->withExceptions( $this->app->bound(LoggedExceptionCollection::class) ? $this->app->make(LoggedExceptionCollection::class) : new LoggedExceptionCollection ); }); } } PKO$W]¡ �ä%ä%Dsrc/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.phpnu„[µü¤assertThat( $this->getTable($table), new HasInDatabase($this->getConnection($connection, $table), $data) ); return $this; } /** * Assert that a given where condition does not exist in the database. * * @param \Illuminate\Database\Eloquent\Model|string $table * @param array $data * @param string|null $connection * @return $this */ protected function assertDatabaseMissing($table, array $data, $connection = null) { $constraint = new ReverseConstraint( new HasInDatabase($this->getConnection($connection, $table), $data) ); $this->assertThat($this->getTable($table), $constraint); return $this; } /** * Assert the count of table entries. * * @param \Illuminate\Database\Eloquent\Model|string $table * @param int $count * @param string|null $connection * @return $this */ protected function assertDatabaseCount($table, int $count, $connection = null) { $this->assertThat( $this->getTable($table), new CountInDatabase($this->getConnection($connection, $table), $count) ); return $this; } /** * Assert that the given table has no entries. * * @param \Illuminate\Database\Eloquent\Model|string $table * @param string|null $connection * @return $this */ protected function assertDatabaseEmpty($table, $connection = null) { $this->assertThat( $this->getTable($table), new CountInDatabase($this->getConnection($connection, $table), 0) ); return $this; } /** * Assert the given record has been "soft deleted". * * @param \Illuminate\Database\Eloquent\Model|string $table * @param array $data * @param string|null $connection * @param string|null $deletedAtColumn * @return $this */ protected function assertSoftDeleted($table, array $data = [], $connection = null, $deletedAtColumn = 'deleted_at') { if ($this->isSoftDeletableModel($table)) { return $this->assertSoftDeleted( $table->getTable(), array_merge($data, [$table->getKeyName() => $table->getKey()]), $table->getConnectionName(), $table->getDeletedAtColumn() ); } $this->assertThat( $this->getTable($table), new SoftDeletedInDatabase( $this->getConnection($connection, $table), $data, $this->getDeletedAtColumn($table, $deletedAtColumn) ) ); return $this; } /** * Assert the given record has not been "soft deleted". * * @param \Illuminate\Database\Eloquent\Model|string $table * @param array $data * @param string|null $connection * @param string|null $deletedAtColumn * @return $this */ protected function assertNotSoftDeleted($table, array $data = [], $connection = null, $deletedAtColumn = 'deleted_at') { if ($this->isSoftDeletableModel($table)) { return $this->assertNotSoftDeleted( $table->getTable(), array_merge($data, [$table->getKeyName() => $table->getKey()]), $table->getConnectionName(), $table->getDeletedAtColumn() ); } $this->assertThat( $this->getTable($table), new NotSoftDeletedInDatabase( $this->getConnection($connection, $table), $data, $this->getDeletedAtColumn($table, $deletedAtColumn) ) ); return $this; } /** * Assert the given model exists in the database. * * @param \Illuminate\Database\Eloquent\Model $model * @return $this */ protected function assertModelExists($model) { return $this->assertDatabaseHas( $model->getTable(), [$model->getKeyName() => $model->getKey()], $model->getConnectionName() ); } /** * Assert the given model does not exist in the database. * * @param \Illuminate\Database\Eloquent\Model $model * @return $this */ protected function assertModelMissing($model) { return $this->assertDatabaseMissing( $model->getTable(), [$model->getKeyName() => $model->getKey()], $model->getConnectionName() ); } /** * Specify the number of database queries that should occur throughout the test. * * @param int $expected * @param string|null $connection * @return $this */ public function expectsDatabaseQueryCount($expected, $connection = null) { with($this->getConnection($connection), function ($connectionInstance) use ($expected, $connection) { $actual = 0; $connectionInstance->listen(function (QueryExecuted $event) use (&$actual, $connectionInstance, $connection) { if (is_null($connection) || $connectionInstance === $event->connection) { $actual++; } }); $this->beforeApplicationDestroyed(function () use (&$actual, $expected, $connectionInstance) { $this->assertSame( $actual, $expected, "Expected {$expected} database queries on the [{$connectionInstance->getName()}] connection. {$actual} occurred." ); }); }); return $this; } /** * Determine if the argument is a soft deletable model. * * @param mixed $model * @return bool */ protected function isSoftDeletableModel($model) { return $model instanceof Model && in_array(SoftDeletes::class, class_uses_recursive($model)); } /** * Cast a JSON string to a database compatible type. * * @param array|object|string $value * @return \Illuminate\Contracts\Database\Query\Expression */ public function castAsJson($value) { if ($value instanceof Jsonable) { $value = $value->toJson(); } elseif (is_array($value) || is_object($value)) { $value = json_encode($value); } $value = DB::connection()->getPdo()->quote($value); return DB::raw( DB::connection()->getQueryGrammar()->compileJsonValueCast($value) ); } /** * Get the database connection. * * @param string|null $connection * @param string|null $table * @return \Illuminate\Database\Connection */ protected function getConnection($connection = null, $table = null) { $database = $this->app->make('db'); $connection = $connection ?: $this->getTableConnection($table) ?: $database->getDefaultConnection(); return $database->connection($connection); } /** * Get the table name from the given model or string. * * @param \Illuminate\Database\Eloquent\Model|string $table * @return string */ protected function getTable($table) { return $this->newModelFor($table)?->getTable() ?: $table; } /** * Get the table connection specified in the given model. * * @param \Illuminate\Database\Eloquent\Model|string $table * @return string|null */ protected function getTableConnection($table) { return $this->newModelFor($table)?->getConnectionName(); } /** * Get the table column name used for soft deletes. * * @param string $table * @param string $defaultColumnName * @return string */ protected function getDeletedAtColumn($table, $defaultColumnName = 'deleted_at') { return $this->newModelFor($table)?->getDeletedAtColumn() ?: $defaultColumnName; } /** * Get the model entity from the given model or string. * * @param \Illuminate\Database\Eloquent\Model|string $table * @return \Illuminate\Database\Eloquent\Model|null */ protected function newModelFor($table) { return is_subclass_of($table, Model::class) ? (new $table) : null; } /** * Seed a given database connection. * * @param array|string $class * @return $this */ public function seed($class = 'Database\\Seeders\\DatabaseSeeder') { foreach (Arr::wrap($class) as $class) { $this->artisan('db:seed', ['--class' => $class, '--no-interaction' => true]); } return $this; } } PKO$W]|�ÕËZ Z Asrc/Illuminate/Foundation/Testing/Concerns/InteractsWithViews.phpnu„[µü¤getPaths())) { ViewFacade::addLocation(sys_get_temp_dir()); } $tempFileInfo = pathinfo(tempnam($tempDirectory, 'laravel-blade')); $tempFile = $tempFileInfo['dirname'].'/'.$tempFileInfo['filename'].'.blade.php'; file_put_contents($tempFile, $template); return new TestView(view($tempFileInfo['filename'], $data)); } /** * Render the given view component. * * @param string $componentClass * @param \Illuminate\Contracts\Support\Arrayable|array $data * @return \Illuminate\Testing\TestComponent */ protected function component(string $componentClass, $data = []) { $component = $this->app->make($componentClass, $data); $view = value($component->resolveView(), $data); $view = $view instanceof View ? $view->with($component->data()) : view($view, $component->data()); return new TestComponent($component, $view); } /** * Populate the shared view error bag with the given errors. * * @param array $errors * @param string $key * @return $this */ protected function withViewErrors(array $errors, $key = 'default') { ViewFacade::share('errors', (new ViewErrorBag)->put($key, new MessageBag($errors))); return $this; } } PKO$W]ºÛòØ¥¥.src/Illuminate/Foundation/Testing/Wormhole.phpnu„[µü¤value = $value; } /** * Travel forward the given number of milliseconds. * * @param callable|null $callback * @return mixed */ public function millisecond($callback = null) { return $this->milliseconds($callback); } /** * Travel forward the given number of milliseconds. * * @param callable|null $callback * @return mixed */ public function milliseconds($callback = null) { Carbon::setTestNow(Carbon::now()->addMilliseconds($this->value)); return $this->handleCallback($callback); } /** * Travel forward the given number of seconds. * * @param callable|null $callback * @return mixed */ public function second($callback = null) { return $this->seconds($callback); } /** * Travel forward the given number of seconds. * * @param callable|null $callback * @return mixed */ public function seconds($callback = null) { Carbon::setTestNow(Carbon::now()->addSeconds($this->value)); return $this->handleCallback($callback); } /** * Travel forward the given number of minutes. * * @param callable|null $callback * @return mixed */ public function minute($callback = null) { return $this->minutes($callback); } /** * Travel forward the given number of minutes. * * @param callable|null $callback * @return mixed */ public function minutes($callback = null) { Carbon::setTestNow(Carbon::now()->addMinutes($this->value)); return $this->handleCallback($callback); } /** * Travel forward the given number of hours. * * @param callable|null $callback * @return mixed */ public function hour($callback = null) { return $this->hours($callback); } /** * Travel forward the given number of hours. * * @param callable|null $callback * @return mixed */ public function hours($callback = null) { Carbon::setTestNow(Carbon::now()->addHours($this->value)); return $this->handleCallback($callback); } /** * Travel forward the given number of days. * * @param callable|null $callback * @return mixed */ public function day($callback = null) { return $this->days($callback); } /** * Travel forward the given number of days. * * @param callable|null $callback * @return mixed */ public function days($callback = null) { Carbon::setTestNow(Carbon::now()->addDays($this->value)); return $this->handleCallback($callback); } /** * Travel forward the given number of weeks. * * @param callable|null $callback * @return mixed */ public function week($callback = null) { return $this->weeks($callback); } /** * Travel forward the given number of weeks. * * @param callable|null $callback * @return mixed */ public function weeks($callback = null) { Carbon::setTestNow(Carbon::now()->addWeeks($this->value)); return $this->handleCallback($callback); } /** * Travel forward the given number of months. * * @param callable|null $callback * @return mixed */ public function month($callback = null) { return $this->months($callback); } /** * Travel forward the given number of months. * * @param callable|null $callback * @return mixed */ public function months($callback = null) { Carbon::setTestNow(Carbon::now()->addMonths($this->value)); return $this->handleCallback($callback); } /** * Travel forward the given number of years. * * @param callable|null $callback * @return mixed */ public function year($callback = null) { return $this->years($callback); } /** * Travel forward the given number of years. * * @param callable|null $callback * @return mixed */ public function years($callback = null) { Carbon::setTestNow(Carbon::now()->addYears($this->value)); return $this->handleCallback($callback); } /** * Travel back to the current time. * * @return \DateTimeInterface */ public static function back() { Carbon::setTestNow(); return Carbon::now(); } /** * Handle the given optional execution callback. * * @param callable|null $callback * @return mixed */ protected function handleCallback($callback) { if ($callback) { return tap($callback(), function () { Carbon::setTestNow(); }); } } } PKO$W]ü2„Jsrc/Illuminate/Foundation/Testing/Traits/CanConfigureMigrationCommands.phpnu„[µü¤seeder(); return array_merge( [ '--drop-views' => $this->shouldDropViews(), '--drop-types' => $this->shouldDropTypes(), ], $seeder ? ['--seeder' => $seeder] : ['--seed' => $this->shouldSeed()] ); } /** * Determine if views should be dropped when refreshing the database. * * @return bool */ protected function shouldDropViews() { return property_exists($this, 'dropViews') ? $this->dropViews : false; } /** * Determine if types should be dropped when refreshing the database. * * @return bool */ protected function shouldDropTypes() { return property_exists($this, 'dropTypes') ? $this->dropTypes : false; } /** * Determine if the seed task should be run when refreshing the database. * * @return bool */ protected function shouldSeed() { return property_exists($this, 'seed') ? $this->seed : false; } /** * Determine the specific seeder class that should be used when refreshing the database. * * @return mixed */ protected function seeder() { return property_exists($this, 'seeder') ? $this->seeder : false; } } PKO$W]×ýÄ÷÷;src/Illuminate/Foundation/Testing/LazilyRefreshDatabase.phpnu„[µü¤app->make('db'); $callback = function () { if (RefreshDatabaseState::$lazilyRefreshed) { return; } RefreshDatabaseState::$lazilyRefreshed = true; $shouldMockOutput = $this->mockConsoleOutput; $this->mockConsoleOutput = false; $this->baseRefreshDatabase(); $this->mockConsoleOutput = $shouldMockOutput; }; $database->beforeStartingTransaction($callback); $database->beforeExecuting($callback); $this->beforeApplicationDestroyed(function () { RefreshDatabaseState::$lazilyRefreshed = false; }); } } PKO$W]AX½ŒXX7src/Illuminate/Foundation/Testing/WithConsoleEvents.phpnu„[µü¤app[ConsoleKernel::class]->rerouteSymfonyCommandEvents(); } } PKO$W]?:ííÕÕ/src/Illuminate/Foundation/Testing/WithFaker.phpnu„[µü¤faker = $this->makeFaker(); } /** * Get the default Faker instance for a given locale. * * @param string|null $locale * @return \Faker\Generator */ protected function faker($locale = null) { return is_null($locale) ? $this->faker : $this->makeFaker($locale); } /** * Create a Faker instance for the given locale. * * @param string|null $locale * @return \Faker\Generator */ protected function makeFaker($locale = null) { if (isset($this->app)) { $locale ??= $this->app->make('config')->get('app.faker_locale', Factory::DEFAULT_LOCALE); if ($this->app->bound(Generator::class)) { return $this->app->make(Generator::class, ['locale' => $locale]); } } return Factory::create($locale ?? Factory::DEFAULT_LOCALE); } } PKO$W]å/&qqAsrc/Illuminate/Foundation/Testing/DatabaseTransactionsManager.phpnu„[µü¤callbackApplicableTransactions()->count() === 0) { return $callback(); } $this->pendingTransactions->last()->addCallback($callback); } /** * Get the transactions that are applicable to callbacks. * * @return \Illuminate\Support\Collection */ public function callbackApplicableTransactions() { return $this->pendingTransactions->skip(1)->values(); } /** * Determine if after commit callbacks should be executed for the given transaction level. * * @param int $level * @return bool */ public function afterCommitCallbacksShouldBeExecuted($level) { return $level === 1; } } PKO$W]ù‹d ××8src/Illuminate/Foundation/Testing/DatabaseTruncation.phpnu„[µü¤beforeTruncatingDatabase(); // Migrate and seed the database on first run... if (! RefreshDatabaseState::$migrated) { $this->artisan('migrate:fresh', $this->migrateFreshUsing()); $this->app[Kernel::class]->setArtisan(null); RefreshDatabaseState::$migrated = true; return; } // Always clear any test data on subsequent runs... $this->truncateTablesForAllConnections(); if ($seeder = $this->seeder()) { // Use a specific seeder class... $this->artisan('db:seed', ['--class' => $seeder]); } elseif ($this->shouldSeed()) { // Use the default seeder class... $this->artisan('db:seed'); } $this->afterTruncatingDatabase(); } /** * Truncate the database tables for all configured connections. * * @return void */ protected function truncateTablesForAllConnections(): void { $database = $this->app->make('db'); collect($this->connectionsToTruncate()) ->each(function ($name) use ($database) { $connection = $database->connection($name); $connection->getSchemaBuilder()->withoutForeignKeyConstraints( fn () => $this->truncateTablesForConnection($connection, $name) ); }); } /** * Truncate the database tables for the given database connection. * * @param \Illuminate\Database\ConnectionInterface $connection * @param string|null $name * @return void */ protected function truncateTablesForConnection(ConnectionInterface $connection, ?string $name): void { $dispatcher = $connection->getEventDispatcher(); $connection->unsetEventDispatcher(); collect(static::$allTables[$name] ??= $connection->getDoctrineSchemaManager()->listTableNames()) ->when( property_exists($this, 'tablesToTruncate'), fn ($tables) => $tables->intersect($this->tablesToTruncate), fn ($tables) => $tables->diff($this->exceptTables($name)) ) ->filter(fn ($table) => $connection->table($this->withoutTablePrefix($connection, $table))->exists()) ->each(fn ($table) => $connection->table($this->withoutTablePrefix($connection, $table))->truncate()); $connection->setEventDispatcher($dispatcher); } /** * Remove the table prefix from a table name, if it exists. * * @param \Illuminate\Database\ConnectionInterface $connection * @param string $table * @return string */ protected function withoutTablePrefix(ConnectionInterface $connection, string $table) { $prefix = $connection->getTablePrefix(); return strpos($table, $prefix) === 0 ? substr($table, strlen($prefix)) : $table; } /** * The database connections that should have their tables truncated. * * @return array */ protected function connectionsToTruncate(): array { return property_exists($this, 'connectionsToTruncate') ? $this->connectionsToTruncate : [null]; } /** * Get the tables that should not be truncated. * * @param string|null $connectionName * @return array */ protected function exceptTables(?string $connectionName): array { if (property_exists($this, 'exceptTables')) { $migrationsTable = $this->app['config']->get('database.migrations'); if (array_is_list($this->exceptTables ?? [])) { return array_merge( $this->exceptTables ?? [], [$migrationsTable], ); } return array_merge( $this->exceptTables[$connectionName] ?? [], [$migrationsTable], ); } return [$this->app['config']->get('database.migrations')]; } /** * Perform any work that should take place before the database has started truncating. * * @return void */ protected function beforeTruncatingDatabase(): void { // } /** * Perform any work that should take place once the database has finished truncating. * * @return void */ protected function afterTruncatingDatabase(): void { // } } PKO$W]=ÒŒ:src/Illuminate/Foundation/Exceptions/ReportableHandler.phpnu„[µü¤callback = $callback; } /** * Invoke the handler. * * @param \Throwable $e * @return bool */ public function __invoke(Throwable $e) { $result = call_user_func($this->callback, $e); if ($result === false) { return false; } return ! $this->shouldStop; } /** * Determine if the callback handles the given exception. * * @param \Throwable $e * @return bool */ public function handles(Throwable $e) { foreach ($this->firstClosureParameterTypes($this->callback) as $type) { if (is_a($e, $type)) { return true; } } return false; } /** * Indicate that report handling should stop after invoking this callback. * * @return $this */ public function stop() { $this->shouldStop = true; return $this; } } PKO$W]î!›SSGsrc/Illuminate/Foundation/Exceptions/Whoops/WhoopsExceptionRenderer.phpnu„[µü¤appendHandler($this->whoopsHandler()); $whoops->writeToOutput(false); $whoops->allowQuit(false); })->handleException($throwable); } /** * Get the Whoops handler for the application. * * @return \Whoops\Handler\Handler */ protected function whoopsHandler() { return (new WhoopsHandler)->forDebug(); } } PKO$W]( Çî33=src/Illuminate/Foundation/Exceptions/Whoops/WhoopsHandler.phpnu„[µü¤handleUnconditionally(true); $this->registerApplicationPaths($handler) ->registerBlacklist($handler) ->registerEditor($handler); }); } /** * Register the application paths with the handler. * * @param \Whoops\Handler\PrettyPageHandler $handler * @return $this */ protected function registerApplicationPaths($handler) { $handler->setApplicationPaths( array_flip($this->directoriesExceptVendor()) ); return $this; } /** * Get the application paths except for the "vendor" directory. * * @return array */ protected function directoriesExceptVendor() { return Arr::except( array_flip((new Filesystem)->directories(base_path())), [base_path('vendor')] ); } /** * Register the blacklist with the handler. * * @param \Whoops\Handler\PrettyPageHandler $handler * @return $this */ protected function registerBlacklist($handler) { foreach (config('app.debug_blacklist', config('app.debug_hide', [])) as $key => $secrets) { foreach ($secrets as $secret) { $handler->blacklist($key, $secret); } } return $this; } /** * Register the editor with the handler. * * @param \Whoops\Handler\PrettyPageHandler $handler * @return $this */ protected function registerEditor($handler) { if (config('app.editor', false)) { $handler->setEditor(config('app.editor')); } return $this; } } PKO$W]:E�…‹‹8src/Illuminate/Foundation/Exceptions/views/402.blade.phpnu„[µü¤@extends('errors::minimal') @section('title', __('Payment Required')) @section('code', '402') @section('message', __('Payment Required')) PKO$W]Ú{­Õƒƒ8src/Illuminate/Foundation/Exceptions/views/419.blade.phpnu„[µü¤@extends('errors::minimal') @section('title', __('Page Expired')) @section('code', '419') @section('message', __('Page Expired')) PKO$W]ïŽíÅ}}8src/Illuminate/Foundation/Exceptions/views/404.blade.phpnu„[µü¤@extends('errors::minimal') @section('title', __('Not Found')) @section('code', '404') @section('message', __('Not Found')) PKO$W]Áâ)™™8src/Illuminate/Foundation/Exceptions/views/403.blade.phpnu„[µü¤@extends('errors::minimal') @section('title', __('Forbidden')) @section('code', '403') @section('message', __($exception->getMessage() ?: 'Forbidden')) PKO$W]Ù:çÁƒƒ8src/Illuminate/Foundation/Exceptions/views/500.blade.phpnu„[µü¤@extends('errors::minimal') @section('title', __('Server Error')) @section('code', '500') @section('message', __('Server Error')) PKO$W]÷hã¾ææ<src/Illuminate/Foundation/Exceptions/views/minimal.blade.phpnu„[µü¤ @yield('title')
@yield('code')
@yield('message')
PKO$W]À1À››;src/Illuminate/Foundation/Exceptions/views/layout.blade.phpnu„[µü¤ @yield('title')
@yield('message')
PKO$W]Î7º^ƒƒ8src/Illuminate/Foundation/Exceptions/views/401.blade.phpnu„[µü¤@extends('errors::minimal') @section('title', __('Unauthorized')) @section('code', '401') @section('message', __('Unauthorized')) PKO$W]´6!�‘‘8src/Illuminate/Foundation/Exceptions/views/503.blade.phpnu„[µü¤@extends('errors::minimal') @section('title', __('Service Unavailable')) @section('code', '503') @section('message', __('Service Unavailable')) PKO$W]ä&½U��8src/Illuminate/Foundation/Exceptions/views/429.blade.phpnu„[µü¤@extends('errors::minimal') @section('title', __('Too Many Requests')) @section('code', '429') @section('message', __('Too Many Requests')) PKO$W]±Hð §§?src/Illuminate/Foundation/Exceptions/RegisterErrorViewPaths.phpnu„[µü¤map(function ($path) { return "{$path}/errors"; })->push(__DIR__.'/views')->all()); } } PKO$W]~�•nnfnf0src/Illuminate/Foundation/Exceptions/Handler.phpnu„[µü¤> */ protected $dontReport = []; /** * The callbacks that should be used during reporting. * * @var \Illuminate\Foundation\Exceptions\ReportableHandler[] */ protected $reportCallbacks = []; /** * A map of exceptions with their corresponding custom log levels. * * @var array, \Psr\Log\LogLevel::*> */ protected $levels = []; /** * The callbacks that should be used during rendering. * * @var \Closure[] */ protected $renderCallbacks = []; /** * The registered exception mappings. * * @var array */ protected $exceptionMap = []; /** * Indicates that throttled keys should be hashed. * * @var bool */ protected $hashThrottleKeys = true; /** * A list of the internal exception types that should not be reported. * * @var array> */ protected $internalDontReport = [ AuthenticationException::class, AuthorizationException::class, BackedEnumCaseNotFoundException::class, HttpException::class, HttpResponseException::class, ModelNotFoundException::class, MultipleRecordsFoundException::class, RecordsNotFoundException::class, SuspiciousOperationException::class, TokenMismatchException::class, ValidationException::class, ]; /** * A list of the inputs that are never flashed for validation exceptions. * * @var array */ protected $dontFlash = [ 'current_password', 'password', 'password_confirmation', ]; /** * Indicates that an exception instance should only be reported once. * * @var bool */ protected $withoutDuplicates = false; /** * The already reported exception map. * * @var \WeakMap */ protected $reportedExceptionMap; /** * Create a new exception handler instance. * * @param \Illuminate\Contracts\Container\Container $container * @return void */ public function __construct(Container $container) { $this->container = $container; $this->reportedExceptionMap = new WeakMap; $this->register(); } /** * Register the exception handling callbacks for the application. * * @return void */ public function register() { // } /** * Register a reportable callback. * * @param callable $reportUsing * @return \Illuminate\Foundation\Exceptions\ReportableHandler */ public function reportable(callable $reportUsing) { if (! $reportUsing instanceof Closure) { $reportUsing = Closure::fromCallable($reportUsing); } return tap(new ReportableHandler($reportUsing), function ($callback) { $this->reportCallbacks[] = $callback; }); } /** * Register a renderable callback. * * @param callable $renderUsing * @return $this */ public function renderable(callable $renderUsing) { if (! $renderUsing instanceof Closure) { $renderUsing = Closure::fromCallable($renderUsing); } $this->renderCallbacks[] = $renderUsing; return $this; } /** * Register a new exception mapping. * * @param \Closure|string $from * @param \Closure|string|null $to * @return $this * * @throws \InvalidArgumentException */ public function map($from, $to = null) { if (is_string($to)) { $to = fn ($exception) => new $to('', 0, $exception); } if (is_callable($from) && is_null($to)) { $from = $this->firstClosureParameterType($to = $from); } if (! is_string($from) || ! $to instanceof Closure) { throw new InvalidArgumentException('Invalid exception mapping.'); } $this->exceptionMap[$from] = $to; return $this; } /** * Indicate that the given exception type should not be reported. * * @param string $class * @return $this */ public function ignore(string $class) { $this->dontReport[] = $class; return $this; } /** * Set the log level for the given exception type. * * @param class-string<\Throwable> $type * @param \Psr\Log\LogLevel::* $level * @return $this */ public function level($type, $level) { $this->levels[$type] = $level; return $this; } /** * Report or log an exception. * * @param \Throwable $e * @return void * * @throws \Throwable */ public function report(Throwable $e) { $e = $this->mapException($e); if ($this->shouldntReport($e)) { return; } $this->reportThrowable($e); } /** * Reports error based on report method on exception or to logger. * * @param \Throwable $e * @return void * * @throws \Throwable */ protected function reportThrowable(Throwable $e): void { $this->reportedExceptionMap[$e] = true; if (Reflector::isCallable($reportCallable = [$e, 'report']) && $this->container->call($reportCallable) !== false) { return; } foreach ($this->reportCallbacks as $reportCallback) { if ($reportCallback->handles($e) && $reportCallback($e) === false) { return; } } try { $logger = $this->newLogger(); } catch (Exception) { throw $e; } $level = Arr::first( $this->levels, fn ($level, $type) => $e instanceof $type, LogLevel::ERROR ); $context = $this->buildExceptionContext($e); method_exists($logger, $level) ? $logger->{$level}($e->getMessage(), $context) : $logger->log($level, $e->getMessage(), $context); } /** * Determine if the exception should be reported. * * @param \Throwable $e * @return bool */ public function shouldReport(Throwable $e) { return ! $this->shouldntReport($e); } /** * Determine if the exception is in the "do not report" list. * * @param \Throwable $e * @return bool */ protected function shouldntReport(Throwable $e) { if ($this->withoutDuplicates && ($this->reportedExceptionMap[$e] ?? false)) { return true; } $dontReport = array_merge($this->dontReport, $this->internalDontReport); if (! is_null(Arr::first($dontReport, fn ($type) => $e instanceof $type))) { return true; } return rescue(fn () => with($this->throttle($e), function ($throttle) use ($e) { if ($throttle instanceof Unlimited || $throttle === null) { return false; } if ($throttle instanceof Lottery) { return ! $throttle($e); } return ! $this->container->make(RateLimiter::class)->attempt( with($throttle->key ?: 'illuminate:foundation:exceptions:'.$e::class, fn ($key) => $this->hashThrottleKeys ? md5($key) : $key), $throttle->maxAttempts, fn () => true, 60 * $throttle->decayMinutes ); }), rescue: false, report: false); } /** * Throttle the given exception. * * @param \Throwable $e * @return \Illuminate\Support\Lottery|\Illuminate\Cache\RateLimiting\Limit|null */ protected function throttle(Throwable $e) { return Limit::none(); } /** * Remove the given exception class from the list of exceptions that should be ignored. * * @param string $exception * @return $this */ public function stopIgnoring(string $exception) { $this->dontReport = collect($this->dontReport) ->reject(fn ($ignored) => $ignored === $exception)->values()->all(); $this->internalDontReport = collect($this->internalDontReport) ->reject(fn ($ignored) => $ignored === $exception)->values()->all(); return $this; } /** * Create the context array for logging the given exception. * * @param \Throwable $e * @return array */ protected function buildExceptionContext(Throwable $e) { return array_merge( $this->exceptionContext($e), $this->context(), ['exception' => $e] ); } /** * Get the default exception context variables for logging. * * @param \Throwable $e * @return array */ protected function exceptionContext(Throwable $e) { if (method_exists($e, 'context')) { return $e->context(); } return []; } /** * Get the default context variables for logging. * * @return array */ protected function context() { try { return array_filter([ 'userId' => Auth::id(), ]); } catch (Throwable) { return []; } } /** * Render an exception into an HTTP response. * * @param \Illuminate\Http\Request $request * @param \Throwable $e * @return \Symfony\Component\HttpFoundation\Response * * @throws \Throwable */ public function render($request, Throwable $e) { $e = $this->mapException($e); if (method_exists($e, 'render') && $response = $e->render($request)) { return Router::toResponse($request, $response); } if ($e instanceof Responsable) { return $e->toResponse($request); } $e = $this->prepareException($e); if ($response = $this->renderViaCallbacks($request, $e)) { return $response; } return match (true) { $e instanceof HttpResponseException => $e->getResponse(), $e instanceof AuthenticationException => $this->unauthenticated($request, $e), $e instanceof ValidationException => $this->convertValidationExceptionToResponse($e, $request), default => $this->renderExceptionResponse($request, $e), }; } /** * Prepare exception for rendering. * * @param \Throwable $e * @return \Throwable */ protected function prepareException(Throwable $e) { return match (true) { $e instanceof BackedEnumCaseNotFoundException => new NotFoundHttpException($e->getMessage(), $e), $e instanceof ModelNotFoundException => new NotFoundHttpException($e->getMessage(), $e), $e instanceof AuthorizationException && $e->hasStatus() => new HttpException( $e->status(), $e->response()?->message() ?: (Response::$statusTexts[$e->status()] ?? 'Whoops, looks like something went wrong.'), $e ), $e instanceof AuthorizationException && ! $e->hasStatus() => new AccessDeniedHttpException($e->getMessage(), $e), $e instanceof TokenMismatchException => new HttpException(419, $e->getMessage(), $e), $e instanceof SuspiciousOperationException => new NotFoundHttpException('Bad hostname provided.', $e), $e instanceof RecordsNotFoundException => new NotFoundHttpException('Not found.', $e), default => $e, }; } /** * Map the exception using a registered mapper if possible. * * @param \Throwable $e * @return \Throwable */ protected function mapException(Throwable $e) { if (method_exists($e, 'getInnerException') && ($inner = $e->getInnerException()) instanceof Throwable) { return $inner; } foreach ($this->exceptionMap as $class => $mapper) { if (is_a($e, $class)) { return $mapper($e); } } return $e; } /** * Try to render a response from request and exception via render callbacks. * * @param \Illuminate\Http\Request $request * @param \Throwable $e * @return mixed * * @throws \ReflectionException */ protected function renderViaCallbacks($request, Throwable $e) { foreach ($this->renderCallbacks as $renderCallback) { foreach ($this->firstClosureParameterTypes($renderCallback) as $type) { if (is_a($e, $type)) { $response = $renderCallback($e, $request); if (! is_null($response)) { return $response; } } } } } /** * Render a default exception response if any. * * @param \Illuminate\Http\Request $request * @param \Throwable $e * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse */ protected function renderExceptionResponse($request, Throwable $e) { return $this->shouldReturnJson($request, $e) ? $this->prepareJsonResponse($request, $e) : $this->prepareResponse($request, $e); } /** * Convert an authentication exception into a response. * * @param \Illuminate\Http\Request $request * @param \Illuminate\Auth\AuthenticationException $exception * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse */ protected function unauthenticated($request, AuthenticationException $exception) { return $this->shouldReturnJson($request, $exception) ? response()->json(['message' => $exception->getMessage()], 401) : redirect()->guest($exception->redirectTo() ?? route('login')); } /** * Create a response object from the given validation exception. * * @param \Illuminate\Validation\ValidationException $e * @param \Illuminate\Http\Request $request * @return \Symfony\Component\HttpFoundation\Response */ protected function convertValidationExceptionToResponse(ValidationException $e, $request) { if ($e->response) { return $e->response; } return $this->shouldReturnJson($request, $e) ? $this->invalidJson($request, $e) : $this->invalid($request, $e); } /** * Convert a validation exception into a response. * * @param \Illuminate\Http\Request $request * @param \Illuminate\Validation\ValidationException $exception * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse */ protected function invalid($request, ValidationException $exception) { return redirect($exception->redirectTo ?? url()->previous()) ->withInput(Arr::except($request->input(), $this->dontFlash)) ->withErrors($exception->errors(), $request->input('_error_bag', $exception->errorBag)); } /** * Convert a validation exception into a JSON response. * * @param \Illuminate\Http\Request $request * @param \Illuminate\Validation\ValidationException $exception * @return \Illuminate\Http\JsonResponse */ protected function invalidJson($request, ValidationException $exception) { return response()->json([ 'message' => $exception->getMessage(), 'errors' => $exception->errors(), ], $exception->status); } /** * Determine if the exception handler response should be JSON. * * @param \Illuminate\Http\Request $request * @param \Throwable $e * @return bool */ protected function shouldReturnJson($request, Throwable $e) { return $request->expectsJson(); } /** * Prepare a response for the given exception. * * @param \Illuminate\Http\Request $request * @param \Throwable $e * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse */ protected function prepareResponse($request, Throwable $e) { if (! $this->isHttpException($e) && config('app.debug')) { return $this->toIlluminateResponse($this->convertExceptionToResponse($e), $e)->prepare($request); } if (! $this->isHttpException($e)) { $e = new HttpException(500, $e->getMessage(), $e); } return $this->toIlluminateResponse( $this->renderHttpException($e), $e )->prepare($request); } /** * Create a Symfony response for the given exception. * * @param \Throwable $e * @return \Symfony\Component\HttpFoundation\Response */ protected function convertExceptionToResponse(Throwable $e) { return new SymfonyResponse( $this->renderExceptionContent($e), $this->isHttpException($e) ? $e->getStatusCode() : 500, $this->isHttpException($e) ? $e->getHeaders() : [] ); } /** * Get the response content for the given exception. * * @param \Throwable $e * @return string */ protected function renderExceptionContent(Throwable $e) { try { return config('app.debug') && app()->has(ExceptionRenderer::class) ? $this->renderExceptionWithCustomRenderer($e) : $this->renderExceptionWithSymfony($e, config('app.debug')); } catch (Throwable $e) { return $this->renderExceptionWithSymfony($e, config('app.debug')); } } /** * Render an exception to a string using the registered `ExceptionRenderer`. * * @param \Throwable $e * @return string */ protected function renderExceptionWithCustomRenderer(Throwable $e) { return app(ExceptionRenderer::class)->render($e); } /** * Render an exception to a string using Symfony. * * @param \Throwable $e * @param bool $debug * @return string */ protected function renderExceptionWithSymfony(Throwable $e, $debug) { $renderer = new HtmlErrorRenderer($debug); return $renderer->render($e)->getAsString(); } /** * Render the given HttpException. * * @param \Symfony\Component\HttpKernel\Exception\HttpExceptionInterface $e * @return \Symfony\Component\HttpFoundation\Response */ protected function renderHttpException(HttpExceptionInterface $e) { $this->registerErrorViewPaths(); if ($view = $this->getHttpExceptionView($e)) { try { return response()->view($view, [ 'errors' => new ViewErrorBag, 'exception' => $e, ], $e->getStatusCode(), $e->getHeaders()); } catch (Throwable $t) { config('app.debug') && throw $t; $this->report($t); } } return $this->convertExceptionToResponse($e); } /** * Register the error template hint paths. * * @return void */ protected function registerErrorViewPaths() { (new RegisterErrorViewPaths)(); } /** * Get the view used to render HTTP exceptions. * * @param \Symfony\Component\HttpKernel\Exception\HttpExceptionInterface $e * @return string|null */ protected function getHttpExceptionView(HttpExceptionInterface $e) { $view = 'errors::'.$e->getStatusCode(); if (view()->exists($view)) { return $view; } $view = substr($view, 0, -2).'xx'; if (view()->exists($view)) { return $view; } return null; } /** * Map the given exception into an Illuminate response. * * @param \Symfony\Component\HttpFoundation\Response $response * @param \Throwable $e * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse */ protected function toIlluminateResponse($response, Throwable $e) { if ($response instanceof SymfonyRedirectResponse) { $response = new RedirectResponse( $response->getTargetUrl(), $response->getStatusCode(), $response->headers->all() ); } else { $response = new Response( $response->getContent(), $response->getStatusCode(), $response->headers->all() ); } return $response->withException($e); } /** * Prepare a JSON response for the given exception. * * @param \Illuminate\Http\Request $request * @param \Throwable $e * @return \Illuminate\Http\JsonResponse */ protected function prepareJsonResponse($request, Throwable $e) { return new JsonResponse( $this->convertExceptionToArray($e), $this->isHttpException($e) ? $e->getStatusCode() : 500, $this->isHttpException($e) ? $e->getHeaders() : [], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ); } /** * Convert the given exception to an array. * * @param \Throwable $e * @return array */ protected function convertExceptionToArray(Throwable $e) { return config('app.debug') ? [ 'message' => $e->getMessage(), 'exception' => get_class($e), 'file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => collect($e->getTrace())->map(fn ($trace) => Arr::except($trace, ['args']))->all(), ] : [ 'message' => $this->isHttpException($e) ? $e->getMessage() : 'Server Error', ]; } /** * Render an exception to the console. * * @param \Symfony\Component\Console\Output\OutputInterface $output * @param \Throwable $e * @return void * * @internal This method is not meant to be used or overwritten outside the framework. */ public function renderForConsole($output, Throwable $e) { if ($e instanceof CommandNotFoundException) { $message = str($e->getMessage())->explode('.')->first(); if (! empty($alternatives = $e->getAlternatives())) { $message .= '. Did you mean one of these?'; with(new Error($output))->render($message); with(new BulletList($output))->render($alternatives); $output->writeln(''); } else { with(new Error($output))->render($message); } return; } (new ConsoleApplication)->renderThrowable($e, $output); } /** * Do not report duplicate exceptions. * * @return $this */ public function dontReportDuplicates() { $this->withoutDuplicates = true; return $this; } /** * Determine if the given exception is an HTTP exception. * * @param \Throwable $e * @return bool */ protected function isHttpException(Throwable $e) { return $e instanceof HttpExceptionInterface; } /** * Create a new logger instance. * * @return \Psr\Log\LoggerInterface */ protected function newLogger() { return $this->container->make(LoggerInterface::class); } } PKO$W]çššˆTT-src/Illuminate/Foundation/PackageManifest.phpnu„[µü¤files = $files; $this->basePath = $basePath; $this->manifestPath = $manifestPath; $this->vendorPath = Env::get('COMPOSER_VENDOR_DIR') ?: $basePath.'/vendor'; } /** * Get all of the service provider class names for all packages. * * @return array */ public function providers() { return $this->config('providers'); } /** * Get all of the aliases for all packages. * * @return array */ public function aliases() { return $this->config('aliases'); } /** * Get all of the values for all packages for the given configuration name. * * @param string $key * @return array */ public function config($key) { return collect($this->getManifest())->flatMap(function ($configuration) use ($key) { return (array) ($configuration[$key] ?? []); })->filter()->all(); } /** * Get the current package manifest. * * @return array */ protected function getManifest() { if (! is_null($this->manifest)) { return $this->manifest; } if (! is_file($this->manifestPath)) { $this->build(); } return $this->manifest = is_file($this->manifestPath) ? $this->files->getRequire($this->manifestPath) : []; } /** * Build the manifest and write it to disk. * * @return void */ public function build() { $packages = []; if ($this->files->exists($path = $this->vendorPath.'/composer/installed.json')) { $installed = json_decode($this->files->get($path), true); $packages = $installed['packages'] ?? $installed; } $ignoreAll = in_array('*', $ignore = $this->packagesToIgnore()); $this->write(collect($packages)->mapWithKeys(function ($package) { return [$this->format($package['name']) => $package['extra']['laravel'] ?? []]; })->each(function ($configuration) use (&$ignore) { $ignore = array_merge($ignore, $configuration['dont-discover'] ?? []); })->reject(function ($configuration, $package) use ($ignore, $ignoreAll) { return $ignoreAll || in_array($package, $ignore); })->filter()->all()); } /** * Format the given package name. * * @param string $package * @return string */ protected function format($package) { return str_replace($this->vendorPath.'/', '', $package); } /** * Get all of the package names that should be ignored. * * @return array */ protected function packagesToIgnore() { if (! is_file($this->basePath.'/composer.json')) { return []; } return json_decode(file_get_contents( $this->basePath.'/composer.json' ), true)['extra']['laravel']['dont-discover'] ?? []; } /** * Write the given manifest array to disk. * * @param array $manifest * @return void * * @throws \Exception */ protected function write(array $manifest) { if (! is_writable($dirname = dirname($this->manifestPath))) { throw new Exception("The {$dirname} directory must be present and writable."); } $this->files->replace( $this->manifestPath, ' function () use ($app) { static::configureDisks($app); static::configureUnpooledPostgresConnection($app); static::ensureMigrationsUseUnpooledConnection($app); }, HandleExceptions::class => function () use ($app) { static::configureCloudLogging($app); }, default => fn () => true, })(); } /** * Configure the Laravel Cloud disks if applicable. */ public static function configureDisks(Application $app): void { if (! isset($_SERVER['LARAVEL_CLOUD_DISK_CONFIG'])) { return; } $disks = json_decode($_SERVER['LARAVEL_CLOUD_DISK_CONFIG'], true); foreach ($disks as $disk) { $app['config']->set('filesystems.disks.'.$disk['disk'], [ 'driver' => 's3', 'key' => $disk['access_key_id'], 'secret' => $disk['access_key_secret'], 'bucket' => $disk['bucket'], 'url' => $disk['url'], 'endpoint' => $disk['endpoint'], 'region' => 'auto', 'use_path_style_endpoint' => false, 'throw' => false, 'report' => false, ]); if ($disk['is_default'] ?? false) { $app['config']->set('filesystems.default', $disk['disk']); } } } /** * Configure the unpooled Laravel Postgres connection if applicable. */ public static function configureUnpooledPostgresConnection(Application $app): void { $host = $app['config']->get('database.connections.pgsql.host', ''); if (str_contains($host, 'pg.laravel.cloud') && str_contains($host, '-pooler')) { $app['config']->set( 'database.connections.pgsql-unpooled', array_merge($app['config']->get('database.connections.pgsql'), [ 'host' => str_replace('-pooler', '', $host), ]) ); $app['config']->set( 'database.connections.pgsql.options', array_merge( $app['config']->get('database.connections.pgsql.options', []), [PDO::ATTR_EMULATE_PREPARES => true], ), ); } } /** * Ensure that migrations use the unpooled Postgres connection if applicable. */ public static function ensureMigrationsUseUnpooledConnection(Application $app): void { if (! is_array($app['config']->get('database.connections.pgsql-unpooled'))) { return; } Migrator::resolveConnectionsUsing(function ($resolver, $connection) use ($app) { $connection = $connection ?? $app['config']->get('database.default'); return $resolver->connection( $connection === 'pgsql' ? 'pgsql-unpooled' : $connection ); }); } /** * Configure the Laravel Cloud log channels. */ public static function configureCloudLogging(Application $app): void { $app['config']->set('logging.channels.stderr.formatter_with', [ 'includeStacktraces' => true, ]); $app['config']->set('logging.channels.laravel-cloud-socket', [ 'driver' => 'monolog', 'handler' => SocketHandler::class, 'formatter' => JsonFormatter::class, 'formatter_with' => [ 'includeStacktraces' => true, ], 'with' => [ 'connectionString' => $_ENV['LARAVEL_CLOUD_LOG_SOCKET'] ?? $_SERVER['LARAVEL_CLOUD_LOG_SOCKET'] ?? 'unix:///tmp/cloud-init.sock', 'persistent' => true, ], ]); } } PKO$W]ËN×9src/Illuminate/Foundation/Bootstrap/RegisterProviders.phpnu„[µü¤registerConfiguredProviders(); } } PKO$W]mJBÛÛ7src/Illuminate/Foundation/Bootstrap/RegisterFacades.phpnu„[µü¤make('config')->get('app.aliases', []), $app->make(PackageManifest::class)->aliases() ))->register(); } } PKO$W]D…Âdd5src/Illuminate/Foundation/Bootstrap/BootProviders.phpnu„[µü¤boot(); } } PKO$W]Û§ÝTT8src/Illuminate/Foundation/Bootstrap/HandleExceptions.phpnu„[µü¤forwardsTo('handleError')); set_exception_handler($this->forwardsTo('handleException')); register_shutdown_function($this->forwardsTo('handleShutdown')); if (! $app->environment('testing')) { ini_set('display_errors', 'Off'); } } /** * Report PHP deprecations, or convert PHP errors to ErrorException instances. * * @param int $level * @param string $message * @param string $file * @param int $line * @return void * * @throws \ErrorException */ public function handleError($level, $message, $file = '', $line = 0) { if ($this->isDeprecation($level)) { $this->handleDeprecationError($message, $file, $line, $level); } elseif (error_reporting() & $level) { throw new ErrorException($message, 0, $level, $file, $line); } } /** * Reports a deprecation to the "deprecations" logger. * * @param string $message * @param string $file * @param int $line * @param int $level * @return void */ public function handleDeprecationError($message, $file, $line, $level = E_DEPRECATED) { if ($this->shouldIgnoreDeprecationErrors()) { return; } try { $logger = static::$app->make(LogManager::class); } catch (Exception) { return; } $this->ensureDeprecationLoggerIsConfigured(); $options = static::$app['config']->get('logging.deprecations') ?? []; with($logger->channel('deprecations'), function ($log) use ($message, $file, $line, $level, $options) { if ($options['trace'] ?? false) { $log->warning((string) new ErrorException($message, 0, $level, $file, $line)); } else { $log->warning(sprintf('%s in %s on line %s', $message, $file, $line )); } }); } /** * Determine if deprecation errors should be ignored. * * @return bool */ protected function shouldIgnoreDeprecationErrors() { return ! class_exists(LogManager::class) || ! static::$app->hasBeenBootstrapped() || (static::$app->runningUnitTests() && ! Env::get('LOG_DEPRECATIONS_WHILE_TESTING')); } /** * Ensure the "deprecations" logger is configured. * * @return void */ protected function ensureDeprecationLoggerIsConfigured() { with(static::$app['config'], function ($config) { if ($config->get('logging.channels.deprecations')) { return; } $this->ensureNullLogDriverIsConfigured(); if (is_array($options = $config->get('logging.deprecations'))) { $driver = $options['channel'] ?? 'null'; } else { $driver = $options ?? 'null'; } $config->set('logging.channels.deprecations', $config->get("logging.channels.{$driver}")); }); } /** * Ensure the "null" log driver is configured. * * @return void */ protected function ensureNullLogDriverIsConfigured() { with(static::$app['config'], function ($config) { if ($config->get('logging.channels.null')) { return; } $config->set('logging.channels.null', [ 'driver' => 'monolog', 'handler' => NullHandler::class, ]); }); } /** * Handle an uncaught exception from the application. * * Note: Most exceptions can be handled via the try / catch block in * the HTTP and Console kernels. But, fatal error exceptions must * be handled differently since they are not normal exceptions. * * @param \Throwable $e * @return void */ public function handleException(Throwable $e) { self::$reservedMemory = null; try { $this->getExceptionHandler()->report($e); } catch (Exception) { $exceptionHandlerFailed = true; } if (static::$app->runningInConsole()) { $this->renderForConsole($e); if ($exceptionHandlerFailed ?? false) { exit(1); } } else { $this->renderHttpResponse($e); } } /** * Render an exception to the console. * * @param \Throwable $e * @return void */ protected function renderForConsole(Throwable $e) { $this->getExceptionHandler()->renderForConsole(new ConsoleOutput, $e); } /** * Render an exception as an HTTP response and send it. * * @param \Throwable $e * @return void */ protected function renderHttpResponse(Throwable $e) { $this->getExceptionHandler()->render(static::$app['request'], $e)->send(); } /** * Handle the PHP shutdown event. * * @return void */ public function handleShutdown() { self::$reservedMemory = null; if (! is_null($error = error_get_last()) && $this->isFatal($error['type'])) { $this->handleException($this->fatalErrorFromPhpError($error, 0)); } } /** * Create a new fatal error instance from an error array. * * @param array $error * @param int|null $traceOffset * @return \Symfony\Component\ErrorHandler\Error\FatalError */ protected function fatalErrorFromPhpError(array $error, $traceOffset = null) { return new FatalError($error['message'], 0, $error, $traceOffset); } /** * Forward a method call to the given method if an application instance exists. * * @return callable */ protected function forwardsTo($method) { return fn (...$arguments) => static::$app ? $this->{$method}(...$arguments) : false; } /** * Determine if the error level is a deprecation. * * @param int $level * @return bool */ protected function isDeprecation($level) { return in_array($level, [E_DEPRECATED, E_USER_DEPRECATED]); } /** * Determine if the error type is fatal. * * @param int $type * @return bool */ protected function isFatal($type) { return in_array($type, [E_COMPILE_ERROR, E_CORE_ERROR, E_ERROR, E_PARSE]); } /** * Get an instance of the exception handler. * * @return \Illuminate\Contracts\Debug\ExceptionHandler */ protected function getExceptionHandler() { return static::$app->make(ExceptionHandler::class); } /** * Clear the local application instance from memory. * * @return void */ public static function forgetApp() { static::$app = null; } } PKO$W] Ë¡A999src/Illuminate/Foundation/Bootstrap/LoadConfiguration.phpnu„[µü¤getCachedConfigPath())) { $items = require $cached; $loadedFromCache = true; } // Next we will spin through all of the configuration files in the configuration // directory and load each one into the repository. This will make all of the // options available to the developer for use in various parts of this app. $app->instance('config', $config = new Repository($items)); if (! isset($loadedFromCache)) { $this->loadConfigurationFiles($app, $config); } // Finally, we will set the application's environment based on the configuration // values that were loaded. We will pass a callback which will be used to get // the environment in a web context where an "--env" switch is not present. $app->detectEnvironment(fn () => $config->get('app.env', 'production')); date_default_timezone_set($config->get('app.timezone', 'UTC')); mb_internal_encoding('UTF-8'); } /** * Load the configuration items from all of the files. * * @param \Illuminate\Contracts\Foundation\Application $app * @param \Illuminate\Contracts\Config\Repository $repository * @return void * * @throws \Exception */ protected function loadConfigurationFiles(Application $app, RepositoryContract $repository) { $files = $this->getConfigurationFiles($app); if (! isset($files['app'])) { throw new Exception('Unable to load the "app" configuration file.'); } foreach ($files as $key => $path) { $repository->set($key, require $path); } } /** * Get all of the configuration files for the application. * * @param \Illuminate\Contracts\Foundation\Application $app * @return array */ protected function getConfigurationFiles(Application $app) { $files = []; $configPath = realpath($app->configPath()); foreach (Finder::create()->files()->name('*.php')->in($configPath) as $file) { $directory = $this->getNestedDirectory($file, $configPath); $files[$directory.basename($file->getRealPath(), '.php')] = $file->getRealPath(); } ksort($files, SORT_NATURAL); return $files; } /** * Get the configuration file nesting path. * * @param \SplFileInfo $file * @param string $configPath * @return string */ protected function getNestedDirectory(SplFileInfo $file, $configPath) { $directory = $file->getPath(); if ($nested = trim(str_replace($configPath, '', $directory), DIRECTORY_SEPARATOR)) { $nested = str_replace(DIRECTORY_SEPARATOR, '.', $nested).'.'; } return $nested; } } PKO$W]ãåæÖ Ö @src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.phpnu„[µü¤configurationIsCached()) { return; } $this->checkForSpecificEnvironmentFile($app); try { $this->createDotenv($app)->safeLoad(); } catch (InvalidFileException $e) { $this->writeErrorAndDie($e); } } /** * Detect if a custom environment file matching the APP_ENV exists. * * @param \Illuminate\Contracts\Foundation\Application $app * @return void */ protected function checkForSpecificEnvironmentFile($app) { if ($app->runningInConsole() && ($input = new ArgvInput)->hasParameterOption('--env') && $this->setEnvironmentFilePath($app, $app->environmentFile().'.'.$input->getParameterOption('--env'))) { return; } $environment = Env::get('APP_ENV'); if (! $environment) { return; } $this->setEnvironmentFilePath( $app, $app->environmentFile().'.'.$environment ); } /** * Load a custom environment file. * * @param \Illuminate\Contracts\Foundation\Application $app * @param string $file * @return bool */ protected function setEnvironmentFilePath($app, $file) { if (is_file($app->environmentPath().'/'.$file)) { $app->loadEnvironmentFrom($file); return true; } return false; } /** * Create a Dotenv instance. * * @param \Illuminate\Contracts\Foundation\Application $app * @return \Dotenv\Dotenv */ protected function createDotenv($app) { return Dotenv::create( Env::getRepository(), $app->environmentPath(), $app->environmentFile() ); } /** * Write the error information to the screen and exit. * * @param \Dotenv\Exception\InvalidFileException $e * @return never */ protected function writeErrorAndDie(InvalidFileException $e) { $output = (new ConsoleOutput)->getErrorOutput(); $output->writeln('The environment file is invalid!'); $output->writeln($e->getMessage()); http_response_code(500); exit(1); } } PKO$W]GxkEOO<src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.phpnu„[µü¤make('config')->get('app.url', 'http://localhost'); $components = parse_url($uri); $server = $_SERVER; if (isset($components['path'])) { $server = array_merge($server, [ 'SCRIPT_FILENAME' => $components['path'], 'SCRIPT_NAME' => $components['path'], ]); } $app->instance('request', Request::create( $uri, 'GET', [], [], [], $server )); } } PKO$W]ã:lâ‹‹9src/Illuminate/Foundation/Concerns/ResolvesDumpSource.phpnu„[µü¤ */ protected $editorHrefs = [ 'atom' => 'atom://core/open/file?filename={file}&line={line}', 'emacs' => 'emacs://open?url=file://{file}&line={line}', 'idea' => 'idea://open?file={file}&line={line}', 'macvim' => 'mvim://open/?url=file://{file}&line={line}', 'netbeans' => 'netbeans://open/?f={file}:{line}', 'nova' => 'nova://core/open/file?filename={file}&line={line}', 'phpstorm' => 'phpstorm://open?file={file}&line={line}', 'sublime' => 'subl://open?url=file://{file}&line={line}', 'textmate' => 'txmt://open?url=file://{file}&line={line}', 'vscode' => 'vscode://file/{file}:{line}', 'vscode-insiders' => 'vscode-insiders://file/{file}:{line}', 'vscode-insiders-remote' => 'vscode-insiders://vscode-remote/{file}:{line}', 'vscode-remote' => 'vscode://vscode-remote/{file}:{line}', 'vscodium' => 'vscodium://file/{file}:{line}', 'xdebug' => 'xdebug://{file}@{line}', ]; /** * Files that require special trace handling and their levels. * * @var array */ protected static $adjustableTraces = [ 'symfony/var-dumper/Resources/functions/dump.php' => 1, 'Illuminate/Collections/Traits/EnumeratesValues.php' => 4, ]; /** * The source resolver. * * @var (callable(): (array{0: string, 1: string, 2: int|null}|null))|null|false */ protected static $dumpSourceResolver; /** * Resolve the source of the dump call. * * @return array{0: string, 1: string, 2: int|null}|null */ public function resolveDumpSource() { if (static::$dumpSourceResolver === false) { return null; } if (static::$dumpSourceResolver) { return call_user_func(static::$dumpSourceResolver); } $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 20); $sourceKey = null; foreach ($trace as $traceKey => $traceFile) { if (! isset($traceFile['file'])) { continue; } foreach (self::$adjustableTraces as $name => $key) { if (str_ends_with( $traceFile['file'], str_replace('/', DIRECTORY_SEPARATOR, $name) )) { $sourceKey = $traceKey + $key; break; } } if (! is_null($sourceKey)) { break; } } if (is_null($sourceKey)) { return; } $file = $trace[$sourceKey]['file'] ?? null; $line = $trace[$sourceKey]['line'] ?? null; if (is_null($file) || is_null($line)) { return; } $relativeFile = $file; if ($this->isCompiledViewFile($file)) { $file = $this->getOriginalFileForCompiledView($file); $line = null; } if (str_starts_with($file, $this->basePath)) { $relativeFile = substr($file, strlen($this->basePath) + 1); } return [$file, $relativeFile, $line]; } /** * Determine if the given file is a view compiled. * * @param string $file * @return bool */ protected function isCompiledViewFile($file) { return str_starts_with($file, $this->compiledViewPath) && str_ends_with($file, '.php'); } /** * Get the original view compiled file by the given compiled file. * * @param string $file * @return string */ protected function getOriginalFileForCompiledView($file) { preg_match('/\/\*\*PATH\s(.*)\sENDPATH/', file_get_contents($file), $matches); if (isset($matches[1])) { $file = $matches[1]; } return $file; } /** * Resolve the source href, if possible. * * @param string $file * @param int|null $line * @return string|null */ protected function resolveSourceHref($file, $line) { try { $editor = config('app.editor'); } catch (Throwable) { // .. } if (! isset($editor)) { return; } $href = is_array($editor) && isset($editor['href']) ? $editor['href'] : ($this->editorHrefs[$editor['name'] ?? $editor] ?? sprintf('%s://open?file={file}&line={line}', $editor['name'] ?? $editor)); if ($basePath = $editor['base_path'] ?? false) { $file = str_replace($this->basePath, $basePath, $file); } $href = str_replace( ['{file}', '{line}'], [$file, is_null($line) ? 1 : $line], $href, ); return $href; } /** * Set the resolver that resolves the source of the dump call. * * @param (callable(): (array{0: string, 1: string, 2: int|null}|null))|null $callable * @return void */ public static function resolveDumpSourceUsing($callable) { static::$dumpSourceResolver = $callable; } /** * Don't include the location / file of the dump in dumps. * * @return void */ public static function dontIncludeSource() { static::$dumpSourceResolver = false; } } PKO$W]�=0ôbôb>src/Illuminate/Foundation/Providers/ArtisanServiceProvider.phpnu„[µü¤ AboutCommand::class, 'CacheClear' => CacheClearCommand::class, 'CacheForget' => CacheForgetCommand::class, 'ClearCompiled' => ClearCompiledCommand::class, 'ClearResets' => ClearResetsCommand::class, 'ConfigCache' => ConfigCacheCommand::class, 'ConfigClear' => ConfigClearCommand::class, 'ConfigShow' => ConfigShowCommand::class, 'Db' => DbCommand::class, 'DbMonitor' => DatabaseMonitorCommand::class, 'DbPrune' => PruneCommand::class, 'DbShow' => ShowCommand::class, 'DbTable' => DatabaseTableCommand::class, 'DbWipe' => WipeCommand::class, 'Down' => DownCommand::class, 'Environment' => EnvironmentCommand::class, 'EnvironmentDecrypt' => EnvironmentDecryptCommand::class, 'EnvironmentEncrypt' => EnvironmentEncryptCommand::class, 'EventCache' => EventCacheCommand::class, 'EventClear' => EventClearCommand::class, 'EventList' => EventListCommand::class, 'KeyGenerate' => KeyGenerateCommand::class, 'Optimize' => OptimizeCommand::class, 'OptimizeClear' => OptimizeClearCommand::class, 'PackageDiscover' => PackageDiscoverCommand::class, 'PruneStaleTagsCommand' => PruneStaleTagsCommand::class, 'QueueClear' => QueueClearCommand::class, 'QueueFailed' => ListFailedQueueCommand::class, 'QueueFlush' => FlushFailedQueueCommand::class, 'QueueForget' => ForgetFailedQueueCommand::class, 'QueueListen' => QueueListenCommand::class, 'QueueMonitor' => QueueMonitorCommand::class, 'QueuePruneBatches' => QueuePruneBatchesCommand::class, 'QueuePruneFailedJobs' => QueuePruneFailedJobsCommand::class, 'QueueRestart' => QueueRestartCommand::class, 'QueueRetry' => QueueRetryCommand::class, 'QueueRetryBatch' => QueueRetryBatchCommand::class, 'QueueWork' => QueueWorkCommand::class, 'RouteCache' => RouteCacheCommand::class, 'RouteClear' => RouteClearCommand::class, 'RouteList' => RouteListCommand::class, 'SchemaDump' => DumpCommand::class, 'Seed' => SeedCommand::class, 'ScheduleFinish' => ScheduleFinishCommand::class, 'ScheduleList' => ScheduleListCommand::class, 'ScheduleRun' => ScheduleRunCommand::class, 'ScheduleClearCache' => ScheduleClearCacheCommand::class, 'ScheduleTest' => ScheduleTestCommand::class, 'ScheduleWork' => ScheduleWorkCommand::class, 'ScheduleInterrupt' => ScheduleInterruptCommand::class, 'ShowModel' => ShowModelCommand::class, 'StorageLink' => StorageLinkCommand::class, 'StorageUnlink' => StorageUnlinkCommand::class, 'Up' => UpCommand::class, 'ViewCache' => ViewCacheCommand::class, 'ViewClear' => ViewClearCommand::class, ]; /** * The commands to be registered. * * @var array */ protected $devCommands = [ 'CacheTable' => CacheTableCommand::class, 'CastMake' => CastMakeCommand::class, 'ChannelList' => ChannelListCommand::class, 'ChannelMake' => ChannelMakeCommand::class, 'ComponentMake' => ComponentMakeCommand::class, 'ConsoleMake' => ConsoleMakeCommand::class, 'ControllerMake' => ControllerMakeCommand::class, 'Docs' => DocsCommand::class, 'EventGenerate' => EventGenerateCommand::class, 'EventMake' => EventMakeCommand::class, 'ExceptionMake' => ExceptionMakeCommand::class, 'FactoryMake' => FactoryMakeCommand::class, 'JobMake' => JobMakeCommand::class, 'LangPublish' => LangPublishCommand::class, 'ListenerMake' => ListenerMakeCommand::class, 'MailMake' => MailMakeCommand::class, 'MiddlewareMake' => MiddlewareMakeCommand::class, 'ModelMake' => ModelMakeCommand::class, 'NotificationMake' => NotificationMakeCommand::class, 'NotificationTable' => NotificationTableCommand::class, 'ObserverMake' => ObserverMakeCommand::class, 'PolicyMake' => PolicyMakeCommand::class, 'ProviderMake' => ProviderMakeCommand::class, 'QueueFailedTable' => FailedTableCommand::class, 'QueueTable' => TableCommand::class, 'QueueBatchesTable' => BatchesTableCommand::class, 'RequestMake' => RequestMakeCommand::class, 'ResourceMake' => ResourceMakeCommand::class, 'RuleMake' => RuleMakeCommand::class, 'ScopeMake' => ScopeMakeCommand::class, 'SeederMake' => SeederMakeCommand::class, 'SessionTable' => SessionTableCommand::class, 'Serve' => ServeCommand::class, 'StubPublish' => StubPublishCommand::class, 'TestMake' => TestMakeCommand::class, 'VendorPublish' => VendorPublishCommand::class, 'ViewMake' => ViewMakeCommand::class, ]; /** * Register the service provider. * * @return void */ public function register() { $this->registerCommands(array_merge( $this->commands, $this->devCommands )); Signals::resolveAvailabilityUsing(function () { return $this->app->runningInConsole() && ! $this->app->runningUnitTests() && extension_loaded('pcntl'); }); } /** * Register the given commands. * * @param array $commands * @return void */ protected function registerCommands(array $commands) { foreach ($commands as $commandName => $command) { $method = "register{$commandName}Command"; if (method_exists($this, $method)) { $this->{$method}(); } else { $this->app->singleton($command); } } $this->commands(array_values($commands)); } /** * Register the command. * * @return void */ protected function registerAboutCommand() { $this->app->singleton(AboutCommand::class, function ($app) { return new AboutCommand($app['composer']); }); } /** * Register the command. * * @return void */ protected function registerCacheClearCommand() { $this->app->singleton(CacheClearCommand::class, function ($app) { return new CacheClearCommand($app['cache'], $app['files']); }); } /** * Register the command. * * @return void */ protected function registerCacheForgetCommand() { $this->app->singleton(CacheForgetCommand::class, function ($app) { return new CacheForgetCommand($app['cache']); }); } /** * Register the command. * * @return void */ protected function registerCacheTableCommand() { $this->app->singleton(CacheTableCommand::class, function ($app) { return new CacheTableCommand($app['files'], $app['composer']); }); } /** * Register the command. * * @return void */ protected function registerCastMakeCommand() { $this->app->singleton(CastMakeCommand::class, function ($app) { return new CastMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerChannelMakeCommand() { $this->app->singleton(ChannelMakeCommand::class, function ($app) { return new ChannelMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerComponentMakeCommand() { $this->app->singleton(ComponentMakeCommand::class, function ($app) { return new ComponentMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerConfigCacheCommand() { $this->app->singleton(ConfigCacheCommand::class, function ($app) { return new ConfigCacheCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerConfigClearCommand() { $this->app->singleton(ConfigClearCommand::class, function ($app) { return new ConfigClearCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerConsoleMakeCommand() { $this->app->singleton(ConsoleMakeCommand::class, function ($app) { return new ConsoleMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerControllerMakeCommand() { $this->app->singleton(ControllerMakeCommand::class, function ($app) { return new ControllerMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerEventMakeCommand() { $this->app->singleton(EventMakeCommand::class, function ($app) { return new EventMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerExceptionMakeCommand() { $this->app->singleton(ExceptionMakeCommand::class, function ($app) { return new ExceptionMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerFactoryMakeCommand() { $this->app->singleton(FactoryMakeCommand::class, function ($app) { return new FactoryMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerEventClearCommand() { $this->app->singleton(EventClearCommand::class, function ($app) { return new EventClearCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerJobMakeCommand() { $this->app->singleton(JobMakeCommand::class, function ($app) { return new JobMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerListenerMakeCommand() { $this->app->singleton(ListenerMakeCommand::class, function ($app) { return new ListenerMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerMailMakeCommand() { $this->app->singleton(MailMakeCommand::class, function ($app) { return new MailMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerMiddlewareMakeCommand() { $this->app->singleton(MiddlewareMakeCommand::class, function ($app) { return new MiddlewareMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerModelMakeCommand() { $this->app->singleton(ModelMakeCommand::class, function ($app) { return new ModelMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerNotificationMakeCommand() { $this->app->singleton(NotificationMakeCommand::class, function ($app) { return new NotificationMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerNotificationTableCommand() { $this->app->singleton(NotificationTableCommand::class, function ($app) { return new NotificationTableCommand($app['files'], $app['composer']); }); } /** * Register the command. * * @return void */ protected function registerObserverMakeCommand() { $this->app->singleton(ObserverMakeCommand::class, function ($app) { return new ObserverMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerPolicyMakeCommand() { $this->app->singleton(PolicyMakeCommand::class, function ($app) { return new PolicyMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerProviderMakeCommand() { $this->app->singleton(ProviderMakeCommand::class, function ($app) { return new ProviderMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerQueueForgetCommand() { $this->app->singleton(ForgetFailedQueueCommand::class); } /** * Register the command. * * @return void */ protected function registerQueueListenCommand() { $this->app->singleton(QueueListenCommand::class, function ($app) { return new QueueListenCommand($app['queue.listener']); }); } /** * Register the command. * * @return void */ protected function registerQueueMonitorCommand() { $this->app->singleton(QueueMonitorCommand::class, function ($app) { return new QueueMonitorCommand($app['queue'], $app['events']); }); } /** * Register the command. * * @return void */ protected function registerQueuePruneBatchesCommand() { $this->app->singleton(QueuePruneBatchesCommand::class, function () { return new QueuePruneBatchesCommand; }); } /** * Register the command. * * @return void */ protected function registerQueuePruneFailedJobsCommand() { $this->app->singleton(QueuePruneFailedJobsCommand::class, function () { return new QueuePruneFailedJobsCommand; }); } /** * Register the command. * * @return void */ protected function registerQueueRestartCommand() { $this->app->singleton(QueueRestartCommand::class, function ($app) { return new QueueRestartCommand($app['cache.store']); }); } /** * Register the command. * * @return void */ protected function registerQueueWorkCommand() { $this->app->singleton(QueueWorkCommand::class, function ($app) { return new QueueWorkCommand($app['queue.worker'], $app['cache.store']); }); } /** * Register the command. * * @return void */ protected function registerQueueFailedTableCommand() { $this->app->singleton(FailedTableCommand::class, function ($app) { return new FailedTableCommand($app['files'], $app['composer']); }); } /** * Register the command. * * @return void */ protected function registerQueueTableCommand() { $this->app->singleton(TableCommand::class, function ($app) { return new TableCommand($app['files'], $app['composer']); }); } /** * Register the command. * * @return void */ protected function registerQueueBatchesTableCommand() { $this->app->singleton(BatchesTableCommand::class, function ($app) { return new BatchesTableCommand($app['files'], $app['composer']); }); } /** * Register the command. * * @return void */ protected function registerRequestMakeCommand() { $this->app->singleton(RequestMakeCommand::class, function ($app) { return new RequestMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerResourceMakeCommand() { $this->app->singleton(ResourceMakeCommand::class, function ($app) { return new ResourceMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerRuleMakeCommand() { $this->app->singleton(RuleMakeCommand::class, function ($app) { return new RuleMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerScopeMakeCommand() { $this->app->singleton(ScopeMakeCommand::class, function ($app) { return new ScopeMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerSeederMakeCommand() { $this->app->singleton(SeederMakeCommand::class, function ($app) { return new SeederMakeCommand($app['files'], $app['composer']); }); } /** * Register the command. * * @return void */ protected function registerSessionTableCommand() { $this->app->singleton(SessionTableCommand::class, function ($app) { return new SessionTableCommand($app['files'], $app['composer']); }); } /** * Register the command. * * @return void */ protected function registerRouteCacheCommand() { $this->app->singleton(RouteCacheCommand::class, function ($app) { return new RouteCacheCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerRouteClearCommand() { $this->app->singleton(RouteClearCommand::class, function ($app) { return new RouteClearCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerRouteListCommand() { $this->app->singleton(RouteListCommand::class, function ($app) { return new RouteListCommand($app['router']); }); } /** * Register the command. * * @return void */ protected function registerSeedCommand() { $this->app->singleton(SeedCommand::class, function ($app) { return new SeedCommand($app['db']); }); } /** * Register the command. * * @return void */ protected function registerTestMakeCommand() { $this->app->singleton(TestMakeCommand::class, function ($app) { return new TestMakeCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerVendorPublishCommand() { $this->app->singleton(VendorPublishCommand::class, function ($app) { return new VendorPublishCommand($app['files']); }); } /** * Register the command. * * @return void */ protected function registerViewClearCommand() { $this->app->singleton(ViewClearCommand::class, function ($app) { return new ViewClearCommand($app['files']); }); } /** * Get the services provided by the provider. * * @return array */ public function provides() { return array_merge(array_values($this->commands), array_values($this->devCommands)); } } PKO$W]“W<�Esrc/Illuminate/Foundation/Providers/ConsoleSupportServiceProvider.phpnu„[µü¤app->singleton('composer', function ($app) { return new Composer($app['files'], $app->basePath()); }); } /** * Get the services provided by the provider. * * @return array */ public function provides() { return ['composer']; } } PKO$W]iÎ¥¥Asrc/Illuminate/Foundation/Providers/FoundationServiceProvider.phpnu„[µü¤ HttpFactory::class, Vite::class => Vite::class, ]; /** * Boot the service provider. * * @return void */ public function boot() { if ($this->app->runningInConsole()) { $this->publishes([ __DIR__.'/../Exceptions/views' => $this->app->resourcePath('views/errors/'), ], 'laravel-errors'); } } /** * Register the service provider. * * @return void */ public function register() { parent::register(); $this->registerDumper(); $this->registerRequestValidation(); $this->registerRequestSignatureValidation(); $this->registerExceptionTracking(); $this->registerMaintenanceModeManager(); } /** * Register a var dumper (with source) to debug variables. * * @return void */ public function registerDumper() { AbstractCloner::$defaultCasters[ConnectionInterface::class] ??= [StubCaster::class, 'cutInternals']; AbstractCloner::$defaultCasters[Container::class] ??= [StubCaster::class, 'cutInternals']; AbstractCloner::$defaultCasters[Dispatcher::class] ??= [StubCaster::class, 'cutInternals']; AbstractCloner::$defaultCasters[Factory::class] ??= [StubCaster::class, 'cutInternals']; AbstractCloner::$defaultCasters[Grammar::class] ??= [StubCaster::class, 'cutInternals']; $basePath = $this->app->basePath(); $compiledViewPath = $this->app['config']->get('view.compiled'); $format = $_SERVER['VAR_DUMPER_FORMAT'] ?? null; match (true) { 'html' == $format => HtmlDumper::register($basePath, $compiledViewPath), 'cli' == $format => CliDumper::register($basePath, $compiledViewPath), 'server' == $format => null, $format && 'tcp' == parse_url($format, PHP_URL_SCHEME) => null, default => in_array(PHP_SAPI, ['cli', 'phpdbg']) ? CliDumper::register($basePath, $compiledViewPath) : HtmlDumper::register($basePath, $compiledViewPath), }; } /** * Register the "validate" macro on the request. * * @return void * * @throws \Illuminate\Validation\ValidationException */ public function registerRequestValidation() { Request::macro('validate', function (array $rules, ...$params) { return tap(validator($this->all(), $rules, ...$params), function ($validator) { if ($this->isPrecognitive()) { $validator->after(Precognition::afterValidationHook($this)) ->setRules( $this->filterPrecognitiveRules($validator->getRulesWithoutPlaceholders()) ); } })->validate(); }); Request::macro('validateWithBag', function (string $errorBag, array $rules, ...$params) { try { return $this->validate($rules, ...$params); } catch (ValidationException $e) { $e->errorBag = $errorBag; throw $e; } }); } /** * Register the "hasValidSignature" macro on the request. * * @return void */ public function registerRequestSignatureValidation() { Request::macro('hasValidSignature', function ($absolute = true) { return URL::hasValidSignature($this, $absolute); }); Request::macro('hasValidRelativeSignature', function () { return URL::hasValidSignature($this, $absolute = false); }); Request::macro('hasValidSignatureWhileIgnoring', function ($ignoreQuery = [], $absolute = true) { return URL::hasValidSignature($this, $absolute, $ignoreQuery); }); } /** * Register an event listener to track logged exceptions. * * @return void */ protected function registerExceptionTracking() { if (! $this->app->runningUnitTests()) { return; } $this->app->instance( LoggedExceptionCollection::class, new LoggedExceptionCollection ); $this->app->make('events')->listen(MessageLogged::class, function ($event) { if (isset($event->context['exception'])) { $this->app->make(LoggedExceptionCollection::class) ->push($event->context['exception']); } }); } /** * Register the maintenance mode manager service. * * @return void */ public function registerMaintenanceModeManager() { $this->app->singleton(MaintenanceModeManager::class); $this->app->bind( MaintenanceModeContract::class, fn () => $this->app->make(MaintenanceModeManager::class)->driver() ); } } PKO$W]ní˜,¶¶Bsrc/Illuminate/Foundation/Providers/FormRequestServiceProvider.phpnu„[µü¤app->afterResolving(ValidatesWhenResolved::class, function ($resolved) { $resolved->validateResolved(); }); $this->app->resolving(FormRequest::class, function ($request, $app) { $request = FormRequest::createFrom($app['request'], $request); $request->setContainer($app)->setRedirector($app->make(Redirector::class)); }); } } PKO$W]Ö»EííCsrc/Illuminate/Foundation/Support/Providers/AuthServiceProvider.phpnu„[µü¤ */ protected $policies = []; /** * Register the application's policies. * * @return void */ public function register() { $this->booting(function () { $this->registerPolicies(); }); } /** * Register the application's policies. * * @return void */ public function registerPolicies() { foreach ($this->policies() as $model => $policy) { Gate::policy($model, $policy); } } /** * Get the policies defined on the provider. * * @return array */ public function policies() { return $this->policies; } } PKO$W]EãEWffDsrc/Illuminate/Foundation/Support/Providers/EventServiceProvider.phpnu„[µü¤> */ protected $listen = []; /** * The subscribers to register. * * @var array */ protected $subscribe = []; /** * The model observers to register. * * @var array> */ protected $observers = []; /** * Register the application's event listeners. * * @return void */ public function register() { $this->booting(function () { $events = $this->getEvents(); foreach ($events as $event => $listeners) { foreach (array_unique($listeners, SORT_REGULAR) as $listener) { Event::listen($event, $listener); } } foreach ($this->subscribe as $subscriber) { Event::subscribe($subscriber); } foreach ($this->observers as $model => $observers) { $model::observe($observers); } }); } /** * Boot any application services. * * @return void */ public function boot() { // } /** * Get the events and handlers. * * @return array */ public function listens() { return $this->listen; } /** * Get the discovered events and listeners for the application. * * @return array */ public function getEvents() { if ($this->app->eventsAreCached()) { $cache = require $this->app->getCachedEventsPath(); return $cache[get_class($this)] ?? []; } else { return array_merge_recursive( $this->discoveredEvents(), $this->listens() ); } } /** * Get the discovered events for the application. * * @return array */ protected function discoveredEvents() { return $this->shouldDiscoverEvents() ? $this->discoverEvents() : []; } /** * Determine if events and listeners should be automatically discovered. * * @return bool */ public function shouldDiscoverEvents() { return false; } /** * Discover the events and listeners for the application. * * @return array */ public function discoverEvents() { return collect($this->discoverEventsWithin()) ->reject(function ($directory) { return ! is_dir($directory); }) ->reduce(function ($discovered, $directory) { return array_merge_recursive( $discovered, DiscoverEvents::within($directory, $this->eventDiscoveryBasePath()) ); }, []); } /** * Get the listener directories that should be used to discover events. * * @return array */ protected function discoverEventsWithin() { return [ $this->app->path('Listeners'), ]; } /** * Get the base path to be used during event discovery. * * @return string */ protected function eventDiscoveryBasePath() { return base_path(); } } PKO$W]EkF F Dsrc/Illuminate/Foundation/Support/Providers/RouteServiceProvider.phpnu„[µü¤booted(function () { $this->setRootControllerNamespace(); if ($this->routesAreCached()) { $this->loadCachedRoutes(); } else { $this->loadRoutes(); $this->app->booted(function () { $this->app['router']->getRoutes()->refreshNameLookups(); $this->app['router']->getRoutes()->refreshActionLookups(); }); } }); } /** * Bootstrap any application services. * * @return void */ public function boot() { // } /** * Register the callback that will be used to load the application's routes. * * @param \Closure $routesCallback * @return $this */ protected function routes(Closure $routesCallback) { $this->loadRoutesUsing = $routesCallback; return $this; } /** * Set the root controller namespace for the application. * * @return void */ protected function setRootControllerNamespace() { if (! is_null($this->namespace)) { $this->app[UrlGenerator::class]->setRootControllerNamespace($this->namespace); } } /** * Determine if the application routes are cached. * * @return bool */ protected function routesAreCached() { return $this->app->routesAreCached(); } /** * Load the cached routes for the application. * * @return void */ protected function loadCachedRoutes() { $this->app->booted(function () { require $this->app->getCachedRoutesPath(); }); } /** * Load the application routes. * * @return void */ protected function loadRoutes() { if (! is_null($this->loadRoutesUsing)) { $this->app->call($this->loadRoutesUsing); } elseif (method_exists($this, 'map')) { $this->app->call([$this, 'map']); } } /** * Pass dynamic methods onto the router instance. * * @param string $method * @param array $parameters * @return mixed */ public function __call($method, $parameters) { return $this->forwardCallTo( $this->app->make(Router::class), $method, $parameters ); } } PKO$W]­q�¹d¹d%src/Illuminate/Foundation/helpers.phpnu„[µü¤toResponse(request())); } app()->abort($code, $message, $headers); } } if (! function_exists('abort_if')) { /** * Throw an HttpException with the given data if the given condition is true. * * @param bool $boolean * @param \Symfony\Component\HttpFoundation\Response|\Illuminate\Contracts\Support\Responsable|int $code * @param string $message * @param array $headers * @return void * * @throws \Symfony\Component\HttpKernel\Exception\HttpException * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ function abort_if($boolean, $code, $message = '', array $headers = []) { if ($boolean) { abort($code, $message, $headers); } } } if (! function_exists('abort_unless')) { /** * Throw an HttpException with the given data unless the given condition is true. * * @param bool $boolean * @param \Symfony\Component\HttpFoundation\Response|\Illuminate\Contracts\Support\Responsable|int $code * @param string $message * @param array $headers * @return void * * @throws \Symfony\Component\HttpKernel\Exception\HttpException * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ function abort_unless($boolean, $code, $message = '', array $headers = []) { if (! $boolean) { abort($code, $message, $headers); } } } if (! function_exists('action')) { /** * Generate the URL to a controller action. * * @param string|array $name * @param mixed $parameters * @param bool $absolute * @return string */ function action($name, $parameters = [], $absolute = true) { return app('url')->action($name, $parameters, $absolute); } } if (! function_exists('app')) { /** * Get the available container instance. * * @param string|null $abstract * @param array $parameters * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Foundation\Application|mixed */ function app($abstract = null, array $parameters = []) { if (is_null($abstract)) { return Container::getInstance(); } return Container::getInstance()->make($abstract, $parameters); } } if (! function_exists('app_path')) { /** * Get the path to the application folder. * * @param string $path * @return string */ function app_path($path = '') { return app()->path($path); } } if (! function_exists('asset')) { /** * Generate an asset path for the application. * * @param string $path * @param bool|null $secure * @return string */ function asset($path, $secure = null) { return app('url')->asset($path, $secure); } } if (! function_exists('auth')) { /** * Get the available auth instance. * * @param string|null $guard * @return \Illuminate\Contracts\Auth\Factory|\Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard */ function auth($guard = null) { if (is_null($guard)) { return app(AuthFactory::class); } return app(AuthFactory::class)->guard($guard); } } if (! function_exists('back')) { /** * Create a new redirect response to the previous location. * * @param int $status * @param array $headers * @param mixed $fallback * @return \Illuminate\Http\RedirectResponse */ function back($status = 302, $headers = [], $fallback = false) { return app('redirect')->back($status, $headers, $fallback); } } if (! function_exists('base_path')) { /** * Get the path to the base of the install. * * @param string $path * @return string */ function base_path($path = '') { return app()->basePath($path); } } if (! function_exists('bcrypt')) { /** * Hash the given value against the bcrypt algorithm. * * @param string $value * @param array $options * @return string */ function bcrypt($value, $options = []) { return app('hash')->driver('bcrypt')->make($value, $options); } } if (! function_exists('broadcast')) { /** * Begin broadcasting an event. * * @param mixed|null $event * @return \Illuminate\Broadcasting\PendingBroadcast */ function broadcast($event = null) { return app(BroadcastFactory::class)->event($event); } } if (! function_exists('cache')) { /** * Get / set the specified cache value. * * If an array is passed, we'll assume you want to put to the cache. * * @param mixed ...$arguments key|key,default|data,expiration|null * @return mixed|\Illuminate\Cache\CacheManager * * @throws \InvalidArgumentException */ function cache(...$arguments) { if (empty($arguments)) { return app('cache'); } if (is_string($arguments[0])) { return app('cache')->get(...$arguments); } if (! is_array($arguments[0])) { throw new InvalidArgumentException( 'When setting a value in the cache, you must pass an array of key / value pairs.' ); } return app('cache')->put(key($arguments[0]), reset($arguments[0]), $arguments[1] ?? null); } } if (! function_exists('config')) { /** * Get / set the specified configuration value. * * If an array is passed as the key, we will assume you want to set an array of values. * * @param array|string|null $key * @param mixed $default * @return mixed|\Illuminate\Config\Repository */ function config($key = null, $default = null) { if (is_null($key)) { return app('config'); } if (is_array($key)) { return app('config')->set($key); } return app('config')->get($key, $default); } } if (! function_exists('config_path')) { /** * Get the configuration path. * * @param string $path * @return string */ function config_path($path = '') { return app()->configPath($path); } } if (! function_exists('cookie')) { /** * Create a new cookie instance. * * @param string|null $name * @param string|null $value * @param int $minutes * @param string|null $path * @param string|null $domain * @param bool|null $secure * @param bool $httpOnly * @param bool $raw * @param string|null $sameSite * @return \Illuminate\Cookie\CookieJar|\Symfony\Component\HttpFoundation\Cookie */ function cookie($name = null, $value = null, $minutes = 0, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null) { $cookie = app(CookieFactory::class); if (is_null($name)) { return $cookie; } return $cookie->make($name, $value, $minutes, $path, $domain, $secure, $httpOnly, $raw, $sameSite); } } if (! function_exists('csrf_field')) { /** * Generate a CSRF token form field. * * @return \Illuminate\Support\HtmlString */ function csrf_field() { return new HtmlString(''); } } if (! function_exists('csrf_token')) { /** * Get the CSRF token value. * * @return string * * @throws \RuntimeException */ function csrf_token() { $session = app('session'); if (isset($session)) { return $session->token(); } throw new RuntimeException('Application session store not set.'); } } if (! function_exists('database_path')) { /** * Get the database path. * * @param string $path * @return string */ function database_path($path = '') { return app()->databasePath($path); } } if (! function_exists('decrypt')) { /** * Decrypt the given value. * * @param string $value * @param bool $unserialize * @return mixed */ function decrypt($value, $unserialize = true) { return app('encrypter')->decrypt($value, $unserialize); } } if (! function_exists('dispatch')) { /** * Dispatch a job to its appropriate handler. * * @param mixed $job * @return \Illuminate\Foundation\Bus\PendingDispatch */ function dispatch($job) { return $job instanceof Closure ? new PendingClosureDispatch(CallQueuedClosure::create($job)) : new PendingDispatch($job); } } if (! function_exists('dispatch_sync')) { /** * Dispatch a command to its appropriate handler in the current process. * * Queueable jobs will be dispatched to the "sync" queue. * * @param mixed $job * @param mixed $handler * @return mixed */ function dispatch_sync($job, $handler = null) { return app(Dispatcher::class)->dispatchSync($job, $handler); } } if (! function_exists('encrypt')) { /** * Encrypt the given value. * * @param mixed $value * @param bool $serialize * @return string */ function encrypt($value, $serialize = true) { return app('encrypter')->encrypt($value, $serialize); } } if (! function_exists('event')) { /** * Dispatch an event and call the listeners. * * @param string|object $event * @param mixed $payload * @param bool $halt * @return array|null */ function event(...$args) { return app('events')->dispatch(...$args); } } if (! function_exists('fake') && class_exists(\Faker\Factory::class)) { /** * Get a faker instance. * * @param string|null $locale * @return \Faker\Generator */ function fake($locale = null) { if (app()->bound('config')) { $locale ??= app('config')->get('app.faker_locale'); } $locale ??= 'en_US'; $abstract = \Faker\Generator::class.':'.$locale; if (! app()->bound($abstract)) { app()->singleton($abstract, fn () => \Faker\Factory::create($locale)); } return app()->make($abstract); } } if (! function_exists('info')) { /** * Write some information to the log. * * @param string $message * @param array $context * @return void */ function info($message, $context = []) { app('log')->info($message, $context); } } if (! function_exists('logger')) { /** * Log a debug message to the logs. * * @param string|null $message * @param array $context * @return \Illuminate\Log\LogManager|null */ function logger($message = null, array $context = []) { if (is_null($message)) { return app('log'); } return app('log')->debug($message, $context); } } if (! function_exists('lang_path')) { /** * Get the path to the language folder. * * @param string $path * @return string */ function lang_path($path = '') { return app()->langPath($path); } } if (! function_exists('logs')) { /** * Get a log driver instance. * * @param string|null $driver * @return \Illuminate\Log\LogManager|\Psr\Log\LoggerInterface */ function logs($driver = null) { return $driver ? app('log')->driver($driver) : app('log'); } } if (! function_exists('method_field')) { /** * Generate a form field to spoof the HTTP verb used by forms. * * @param string $method * @return \Illuminate\Support\HtmlString */ function method_field($method) { return new HtmlString(''); } } if (! function_exists('mix')) { /** * Get the path to a versioned Mix file. * * @param string $path * @param string $manifestDirectory * @return \Illuminate\Support\HtmlString|string * * @throws \Exception */ function mix($path, $manifestDirectory = '') { return app(Mix::class)(...func_get_args()); } } if (! function_exists('now')) { /** * Create a new Carbon instance for the current time. * * @param \DateTimeZone|string|null $tz * @return \Illuminate\Support\Carbon */ function now($tz = null) { return Date::now($tz); } } if (! function_exists('old')) { /** * Retrieve an old input item. * * @param string|null $key * @param mixed $default * @return mixed */ function old($key = null, $default = null) { return app('request')->old($key, $default); } } if (! function_exists('policy')) { /** * Get a policy instance for a given class. * * @param object|string $class * @return mixed * * @throws \InvalidArgumentException */ function policy($class) { return app(Gate::class)->getPolicyFor($class); } } if (! function_exists('precognitive')) { /** * Handle a Precognition controller hook. * * @param null|callable $callable * @return mixed */ function precognitive($callable = null) { $callable ??= function () { // }; $payload = $callable(function ($default, $precognition = null) { $response = request()->isPrecognitive() ? ($precognition ?? $default) : $default; abort(Router::toResponse(request(), value($response))); }); if (request()->isPrecognitive()) { abort(204, headers: ['Precognition-Success' => 'true']); } return $payload; } } if (! function_exists('public_path')) { /** * Get the path to the public folder. * * @param string $path * @return string */ function public_path($path = '') { return app()->publicPath($path); } } if (! function_exists('redirect')) { /** * Get an instance of the redirector. * * @param string|null $to * @param int $status * @param array $headers * @param bool|null $secure * @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse */ function redirect($to = null, $status = 302, $headers = [], $secure = null) { if (is_null($to)) { return app('redirect'); } return app('redirect')->to($to, $status, $headers, $secure); } } if (! function_exists('report')) { /** * Report an exception. * * @param \Throwable|string $exception * @return void */ function report($exception) { if (is_string($exception)) { $exception = new Exception($exception); } app(ExceptionHandler::class)->report($exception); } } if (! function_exists('report_if')) { /** * Report an exception if the given condition is true. * * @param bool $boolean * @param \Throwable|string $exception * @return void */ function report_if($boolean, $exception) { if ($boolean) { report($exception); } } } if (! function_exists('report_unless')) { /** * Report an exception unless the given condition is true. * * @param bool $boolean * @param \Throwable|string $exception * @return void */ function report_unless($boolean, $exception) { if (! $boolean) { report($exception); } } } if (! function_exists('request')) { /** * Get an instance of the current request or an input item from the request. * * @param array|string|null $key * @param mixed $default * @return mixed|\Illuminate\Http\Request|string|array|null */ function request($key = null, $default = null) { if (is_null($key)) { return app('request'); } if (is_array($key)) { return app('request')->only($key); } $value = app('request')->__get($key); return is_null($value) ? value($default) : $value; } } if (! function_exists('rescue')) { /** * Catch a potential exception and return a default value. * * @template TRescueValue * @template TRescueFallback * * @param callable(): TRescueValue $callback * @param (callable(\Throwable): TRescueFallback)|TRescueFallback $rescue * @param bool|callable $report * @return TRescueValue|TRescueFallback */ function rescue(callable $callback, $rescue = null, $report = true) { try { return $callback(); } catch (Throwable $e) { if (value($report, $e)) { report($e); } return value($rescue, $e); } } } if (! function_exists('resolve')) { /** * Resolve a service from the container. * * @param string $name * @param array $parameters * @return mixed */ function resolve($name, array $parameters = []) { return app($name, $parameters); } } if (! function_exists('resource_path')) { /** * Get the path to the resources folder. * * @param string $path * @return string */ function resource_path($path = '') { return app()->resourcePath($path); } } if (! function_exists('response')) { /** * Return a new response from the application. * * @param \Illuminate\Contracts\View\View|string|array|null $content * @param int $status * @param array $headers * @return \Illuminate\Http\Response|\Illuminate\Contracts\Routing\ResponseFactory */ function response($content = '', $status = 200, array $headers = []) { $factory = app(ResponseFactory::class); if (func_num_args() === 0) { return $factory; } return $factory->make($content, $status, $headers); } } if (! function_exists('route')) { /** * Generate the URL to a named route. * * @param string $name * @param mixed $parameters * @param bool $absolute * @return string */ function route($name, $parameters = [], $absolute = true) { return app('url')->route($name, $parameters, $absolute); } } if (! function_exists('secure_asset')) { /** * Generate an asset path for the application. * * @param string $path * @return string */ function secure_asset($path) { return asset($path, true); } } if (! function_exists('secure_url')) { /** * Generate a HTTPS url for the application. * * @param string $path * @param mixed $parameters * @return string */ function secure_url($path, $parameters = []) { return url($path, $parameters, true); } } if (! function_exists('session')) { /** * Get / set the specified session value. * * If an array is passed as the key, we will assume you want to set an array of values. * * @param array|string|null $key * @param mixed $default * @return mixed|\Illuminate\Session\Store|\Illuminate\Session\SessionManager */ function session($key = null, $default = null) { if (is_null($key)) { return app('session'); } if (is_array($key)) { return app('session')->put($key); } return app('session')->get($key, $default); } } if (! function_exists('storage_path')) { /** * Get the path to the storage folder. * * @param string $path * @return string */ function storage_path($path = '') { return app()->storagePath($path); } } if (! function_exists('to_route')) { /** * Create a new redirect response to a named route. * * @param string $route * @param mixed $parameters * @param int $status * @param array $headers * @return \Illuminate\Http\RedirectResponse */ function to_route($route, $parameters = [], $status = 302, $headers = []) { return redirect()->route($route, $parameters, $status, $headers); } } if (! function_exists('today')) { /** * Create a new Carbon instance for the current date. * * @param \DateTimeZone|string|null $tz * @return \Illuminate\Support\Carbon */ function today($tz = null) { return Date::today($tz); } } if (! function_exists('trans')) { /** * Translate the given message. * * @param string|null $key * @param array $replace * @param string|null $locale * @return \Illuminate\Contracts\Translation\Translator|string|array|null */ function trans($key = null, $replace = [], $locale = null) { if (is_null($key)) { return app('translator'); } return app('translator')->get($key, $replace, $locale); } } if (! function_exists('trans_choice')) { /** * Translates the given message based on a count. * * @param string $key * @param \Countable|int|float|array $number * @param array $replace * @param string|null $locale * @return string */ function trans_choice($key, $number, array $replace = [], $locale = null) { return app('translator')->choice($key, $number, $replace, $locale); } } if (! function_exists('__')) { /** * Translate the given message. * * @param string|null $key * @param array $replace * @param string|null $locale * @return string|array|null */ function __($key = null, $replace = [], $locale = null) { if (is_null($key)) { return $key; } return trans($key, $replace, $locale); } } if (! function_exists('url')) { /** * Generate a url for the application. * * @param string|null $path * @param mixed $parameters * @param bool|null $secure * @return \Illuminate\Contracts\Routing\UrlGenerator|string */ function url($path = null, $parameters = [], $secure = null) { if (is_null($path)) { return app(UrlGenerator::class); } return app(UrlGenerator::class)->to($path, $parameters, $secure); } } if (! function_exists('validator')) { /** * Create a new Validator instance. * * @param array $data * @param array $rules * @param array $messages * @param array $attributes * @return \Illuminate\Contracts\Validation\Validator|\Illuminate\Contracts\Validation\Factory */ function validator(array $data = [], array $rules = [], array $messages = [], array $attributes = []) { $factory = app(ValidationFactory::class); if (func_num_args() === 0) { return $factory; } return $factory->make($data, $rules, $messages, $attributes); } } if (! function_exists('view')) { /** * Get the evaluated view contents for the given view. * * @param string|null $view * @param \Illuminate\Contracts\Support\Arrayable|array $data * @param array $mergeData * @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory */ function view($view = null, $data = [], $mergeData = []) { $factory = app(ViewFactory::class); if (func_num_args() === 0) { return $factory; } return $factory->make($view, $data, $mergeData); } } PKO$W]Í•'%òò0src/Illuminate/Foundation/ProviderRepository.phpnu„[µü¤app = $app; $this->files = $files; $this->manifestPath = $manifestPath; } /** * Register the application service providers. * * @param array $providers * @return void */ public function load(array $providers) { $manifest = $this->loadManifest(); // First we will load the service manifest, which contains information on all // service providers registered with the application and which services it // provides. This is used to know which services are "deferred" loaders. if ($this->shouldRecompile($manifest, $providers)) { $manifest = $this->compileManifest($providers); } // Next, we will register events to load the providers for each of the events // that it has requested. This allows the service provider to defer itself // while still getting automatically loaded when a certain event occurs. foreach ($manifest['when'] as $provider => $events) { $this->registerLoadEvents($provider, $events); } // We will go ahead and register all of the eagerly loaded providers with the // application so their services can be registered with the application as // a provided service. Then we will set the deferred service list on it. foreach ($manifest['eager'] as $provider) { $this->app->register($provider); } $this->app->addDeferredServices($manifest['deferred']); } /** * Load the service provider manifest JSON file. * * @return array|null */ public function loadManifest() { // The service manifest is a file containing a JSON representation of every // service provided by the application and whether its provider is using // deferred loading or should be eagerly loaded on each request to us. if ($this->files->exists($this->manifestPath)) { $manifest = $this->files->getRequire($this->manifestPath); if ($manifest) { return array_merge(['when' => []], $manifest); } } } /** * Determine if the manifest should be compiled. * * @param array $manifest * @param array $providers * @return bool */ public function shouldRecompile($manifest, $providers) { return is_null($manifest) || $manifest['providers'] != $providers; } /** * Register the load events for the given provider. * * @param string $provider * @param array $events * @return void */ protected function registerLoadEvents($provider, array $events) { if (count($events) < 1) { return; } $this->app->make('events')->listen($events, fn () => $this->app->register($provider)); } /** * Compile the application service manifest file. * * @param array $providers * @return array */ protected function compileManifest($providers) { // The service manifest should contain a list of all of the providers for // the application so we can compare it on each request to the service // and determine if the manifest should be recompiled or is current. $manifest = $this->freshManifest($providers); foreach ($providers as $provider) { $instance = $this->createProvider($provider); // When recompiling the service manifest, we will spin through each of the // providers and check if it's a deferred provider or not. If so we'll // add it's provided services to the manifest and note the provider. if ($instance->isDeferred()) { foreach ($instance->provides() as $service) { $manifest['deferred'][$service] = $provider; } $manifest['when'][$provider] = $instance->when(); } // If the service providers are not deferred, we will simply add it to an // array of eagerly loaded providers that will get registered on every // request to this application instead of "lazy" loading every time. else { $manifest['eager'][] = $provider; } } return $this->writeManifest($manifest); } /** * Create a fresh service manifest data structure. * * @param array $providers * @return array */ protected function freshManifest(array $providers) { return ['providers' => $providers, 'eager' => [], 'deferred' => []]; } /** * Write the service manifest file to disk. * * @param array $manifest * @return array * * @throws \Exception */ public function writeManifest($manifest) { if (! is_writable($dirname = dirname($this->manifestPath))) { throw new Exception("The {$dirname} directory must be present and writable."); } $this->files->replace( $this->manifestPath, ' []], $manifest); } /** * Create a new provider instance. * * @param string $provider * @return \Illuminate\Support\ServiceProvider */ public function createProvider($provider) { return new $provider($this->app); } } PKO$W]$Y ¨c&c&2src/Illuminate/Foundation/Console/AboutCommand.phpnu„[µü¤composer = $composer; } /** * Execute the console command. * * @return int */ public function handle() { $this->gatherApplicationInformation(); collect(static::$data) ->map(fn ($items) => collect($items) ->map(function ($value) { if (is_array($value)) { return [$value]; } if (is_string($value)) { $value = $this->laravel->make($value); } return collect($this->laravel->call($value)) ->map(fn ($value, $key) => [$key, $value]) ->values() ->all(); })->flatten(1) ) ->sortBy(function ($data, $key) { $index = array_search($key, ['Environment', 'Cache', 'Drivers']); return $index === false ? 99 : $index; }) ->filter(function ($data, $key) { return $this->option('only') ? in_array($this->toSearchKeyword($key), $this->sections()) : true; }) ->pipe(fn ($data) => $this->display($data)); $this->newLine(); return 0; } /** * Display the application information. * * @param \Illuminate\Support\Collection $data * @return void */ protected function display($data) { $this->option('json') ? $this->displayJson($data) : $this->displayDetail($data); } /** * Display the application information as a detail view. * * @param \Illuminate\Support\Collection $data * @return void */ protected function displayDetail($data) { $data->each(function ($data, $section) { $this->newLine(); $this->components->twoColumnDetail(' '.$section.''); $data->pipe(fn ($data) => $section !== 'Environment' ? $data->sort() : $data)->each(function ($detail) { [$label, $value] = $detail; $this->components->twoColumnDetail($label, value($value, false)); }); }); } /** * Display the application information as JSON. * * @param \Illuminate\Support\Collection $data * @return void */ protected function displayJson($data) { $output = $data->flatMap(function ($data, $section) { return [ (string) Str::of($section)->snake() => $data->mapWithKeys(fn ($item, $key) => [ $this->toSearchKeyword($item[0]) => value($item[1], true), ]), ]; }); $this->output->writeln(strip_tags(json_encode($output))); } /** * Gather information about the application. * * @return void */ protected function gatherApplicationInformation() { self::$data = []; $formatEnabledStatus = fn ($value) => $value ? 'ENABLED' : 'OFF'; $formatCachedStatus = fn ($value) => $value ? 'CACHED' : 'NOT CACHED'; static::addToSection('Environment', fn () => [ 'Application Name' => config('app.name'), 'Laravel Version' => $this->laravel->version(), 'PHP Version' => phpversion(), 'Composer Version' => $this->composer->getVersion() ?? '-', 'Environment' => $this->laravel->environment(), 'Debug Mode' => static::format(config('app.debug'), console: $formatEnabledStatus), 'URL' => Str::of(config('app.url'))->replace(['http://', 'https://'], ''), 'Maintenance Mode' => static::format($this->laravel->isDownForMaintenance(), console: $formatEnabledStatus), ]); static::addToSection('Cache', fn () => [ 'Config' => static::format($this->laravel->configurationIsCached(), console: $formatCachedStatus), 'Events' => static::format($this->laravel->eventsAreCached(), console: $formatCachedStatus), 'Routes' => static::format($this->laravel->routesAreCached(), console: $formatCachedStatus), 'Views' => static::format($this->hasPhpFiles($this->laravel->storagePath('framework/views')), console: $formatCachedStatus), ]); static::addToSection('Drivers', fn () => array_filter([ 'Broadcasting' => config('broadcasting.default'), 'Cache' => config('cache.default'), 'Database' => config('database.default'), 'Logs' => function ($json) { $logChannel = config('logging.default'); if (config('logging.channels.'.$logChannel.'.driver') === 'stack') { $secondary = collect(config('logging.channels.'.$logChannel.'.channels')); return value(static::format( value: $logChannel, console: fn ($value) => ''.$value.' / '.$secondary->implode(', '), json: fn () => $secondary->all(), ), $json); } else { $logs = $logChannel; } return $logs; }, 'Mail' => config('mail.default'), 'Octane' => config('octane.server'), 'Queue' => config('queue.default'), 'Scout' => config('scout.driver'), 'Session' => config('session.driver'), ])); collect(static::$customDataResolvers)->each->__invoke(); } /** * Determine whether the given directory has PHP files. * * @param string $path * @return bool */ protected function hasPhpFiles(string $path): bool { return count(glob($path.'/*.php')) > 0; } /** * Add additional data to the output of the "about" command. * * @param string $section * @param callable|string|array $data * @param string|null $value * @return void */ public static function add(string $section, $data, ?string $value = null) { static::$customDataResolvers[] = fn () => static::addToSection($section, $data, $value); } /** * Add additional data to the output of the "about" command. * * @param string $section * @param callable|string|array $data * @param string|null $value * @return void */ protected static function addToSection(string $section, $data, ?string $value = null) { if (is_array($data)) { foreach ($data as $key => $value) { self::$data[$section][] = [$key, $value]; } } elseif (is_callable($data) || ($value === null && class_exists($data))) { self::$data[$section][] = $data; } else { self::$data[$section][] = [$data, $value]; } } /** * Get the sections provided to the command. * * @return array */ protected function sections() { return collect(explode(',', $this->option('only') ?? '')) ->filter() ->map(fn ($only) => $this->toSearchKeyword($only)) ->all(); } /** * Materialize a function that formats a given value for CLI or JSON output. * * @param mixed $value * @param (\Closure(mixed):(mixed))|null $console * @param (\Closure(mixed):(mixed))|null $json * @return \Closure(bool):mixed */ public static function format($value, ?Closure $console = null, ?Closure $json = null) { return function ($isJson) use ($value, $console, $json) { if ($isJson === true && $json instanceof Closure) { return value($json, $value); } elseif ($isJson === false && $console instanceof Closure) { return value($console, $value); } return value($value); }; } /** * Format the given string for searching. * * @param string $value * @return string */ protected function toSearchKeyword(string $value) { return (string) Str::of($value)->lower()->snake(); } /** * Flush the registered about data. * * @return void */ public static function flushState() { static::$data = []; static::$customDataResolvers = []; } } PKO$W]®ÞsÛÛ:src/Illuminate/Foundation/Console/OptimizeClearCommand.phpnu„[µü¤components->info('Clearing cached bootstrap files.'); collect([ 'events' => fn () => $this->callSilent('event:clear') == 0, 'views' => fn () => $this->callSilent('view:clear') == 0, 'cache' => fn () => $this->callSilent('cache:clear') == 0, 'route' => fn () => $this->callSilent('route:clear') == 0, 'config' => fn () => $this->callSilent('config:clear') == 0, 'compiled' => fn () => $this->callSilent('clear-compiled') == 0, ])->each(fn ($task, $description) => $this->components->task($description, $task)); $this->newLine(); } } PKO$W]Fæê¦$¦$:src/Illuminate/Foundation/Console/VendorPublishCommand.phpnu„[µü¤files = $files; } /** * Execute the console command. * * @return void */ public function handle() { $this->determineWhatShouldBePublished(); foreach ($this->tags ?: [null] as $tag) { $this->publishTag($tag); } } /** * Determine the provider or tag(s) to publish. * * @return void */ protected function determineWhatShouldBePublished() { if ($this->option('all')) { return; } [$this->provider, $this->tags] = [ $this->option('provider'), (array) $this->option('tag'), ]; if (! $this->provider && ! $this->tags) { $this->promptForProviderOrTag(); } } /** * Prompt for which provider or tag to publish. * * @return void */ protected function promptForProviderOrTag() { $choices = $this->publishableChoices(); $choice = windows_os() ? select( "Which provider or tag's files would you like to publish?", $choices, scroll: 15, ) : search( label: "Which provider or tag's files would you like to publish?", placeholder: 'Search...', options: fn ($search) => array_values(array_filter( $choices, fn ($choice) => str_contains(strtolower($choice), strtolower($search)) )), scroll: 15, ); if ($choice == $choices[0] || is_null($choice)) { return; } $this->parseChoice($choice); } /** * The choices available via the prompt. * * @return array */ protected function publishableChoices() { return array_merge( ['All providers and tags'], preg_filter('/^/', 'Provider: ', Arr::sort(ServiceProvider::publishableProviders())), preg_filter('/^/', 'Tag: ', Arr::sort(ServiceProvider::publishableGroups())) ); } /** * Parse the answer that was given via the prompt. * * @param string $choice * @return void */ protected function parseChoice($choice) { [$type, $value] = explode(': ', strip_tags($choice)); if ($type === 'Provider') { $this->provider = $value; } elseif ($type === 'Tag') { $this->tags = [$value]; } } /** * Publishes the assets for a tag. * * @param string $tag * @return mixed */ protected function publishTag($tag) { $pathsToPublish = $this->pathsToPublish($tag); if ($publishing = count($pathsToPublish) > 0) { $this->components->info(sprintf( 'Publishing %sassets', $tag ? "[$tag] " : '', )); } foreach ($pathsToPublish as $from => $to) { $this->publishItem($from, $to); } if ($publishing === false) { $this->components->info('No publishable resources for tag ['.$tag.'].'); } else { $this->laravel['events']->dispatch(new VendorTagPublished($tag, $pathsToPublish)); $this->newLine(); } } /** * Get all of the paths to publish. * * @param string $tag * @return array */ protected function pathsToPublish($tag) { return ServiceProvider::pathsToPublish( $this->provider, $tag ); } /** * Publish the given item from and to the given location. * * @param string $from * @param string $to * @return void */ protected function publishItem($from, $to) { if ($this->files->isFile($from)) { return $this->publishFile($from, $to); } elseif ($this->files->isDirectory($from)) { return $this->publishDirectory($from, $to); } $this->components->error("Can't locate path: <{$from}>"); } /** * Publish the file to the given path. * * @param string $from * @param string $to * @return void */ protected function publishFile($from, $to) { if ((! $this->option('existing') && (! $this->files->exists($to) || $this->option('force'))) || ($this->option('existing') && $this->files->exists($to))) { $this->createParentDirectory(dirname($to)); $this->files->copy($from, $to); $this->status($from, $to, 'file'); } else { if ($this->option('existing')) { $this->components->twoColumnDetail(sprintf( 'File [%s] does not exist', str_replace(base_path().'/', '', $to), ), 'SKIPPED'); } else { $this->components->twoColumnDetail(sprintf( 'File [%s] already exists', str_replace(base_path().'/', '', realpath($to)), ), 'SKIPPED'); } } } /** * Publish the directory to the given directory. * * @param string $from * @param string $to * @return void */ protected function publishDirectory($from, $to) { $visibility = PortableVisibilityConverter::fromArray([], Visibility::PUBLIC); $this->moveManagedFiles(new MountManager([ 'from' => new Flysystem(new LocalAdapter($from)), 'to' => new Flysystem(new LocalAdapter($to, $visibility)), ])); $this->status($from, $to, 'directory'); } /** * Move all the files in the given MountManager. * * @param \League\Flysystem\MountManager $manager * @return void */ protected function moveManagedFiles($manager) { foreach ($manager->listContents('from://', true) as $file) { $path = Str::after($file['path'], 'from://'); if ( $file['type'] === 'file' && ( (! $this->option('existing') && (! $manager->fileExists('to://'.$path) || $this->option('force'))) || ($this->option('existing') && $manager->fileExists('to://'.$path)) ) ) { $manager->write('to://'.$path, $manager->read($file['path'])); } } } /** * Create the directory to house the published files if needed. * * @param string $directory * @return void */ protected function createParentDirectory($directory) { if (! $this->files->isDirectory($directory)) { $this->files->makeDirectory($directory, 0755, true); } } /** * Write a status message to the console. * * @param string $from * @param string $to * @param string $type * @return void */ protected function status($from, $to, $type) { $from = str_replace(base_path().'/', '', realpath($from)); $to = str_replace(base_path().'/', '', realpath($to)); $this->components->task(sprintf( 'Copying %s [%s] to [%s]', $type, $from, $to, )); } } PKO$W];ÎodÕÕ6src/Illuminate/Foundation/Console/EventMakeCommand.phpnu„[µü¤files->exists($this->getPath($this->qualifyClass($rawName))); } /** * Get the stub file for the generator. * * @return string */ protected function getStub() { return $this->resolveStubPath('/stubs/event.stub'); } /** * Resolve the fully-qualified path to the stub. * * @param string $stub * @return string */ protected function resolveStubPath($stub) { return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) ? $customPath : __DIR__.$stub; } /** * Get the default namespace for the class. * * @param string $rootNamespace * @return string */ protected function getDefaultNamespace($rootNamespace) { return $rootNamespace.'\Events'; } /** * Get the console command options. * * @return array */ protected function getOptions() { return [ ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the event already exists'], ]; } } PKO$W]gi§ÛÛ7src/Illuminate/Foundation/Console/EventCacheCommand.phpnu„[µü¤callSilent('event:clear'); file_put_contents( $this->laravel->getCachedEventsPath(), 'getEvents(), true).';' ); $this->components->info('Events cached successfully.'); } /** * Get all of the events and listeners configured for the application. * * @return array */ protected function getEvents() { $events = []; foreach ($this->laravel->getProviders(EventServiceProvider::class) as $provider) { $providerEvents = array_merge_recursive($provider->shouldDiscoverEvents() ? $provider->discoverEvents() : [], $provider->listens()); $events[get_class($provider)] = $providerEvents; } return $events; } } PKO$W]ɬÒÒ:src/Illuminate/Foundation/Console/StorageUnlinkCommand.phpnu„[µü¤links() as $link => $target) { if (! file_exists($link) || ! is_link($link)) { continue; } $this->laravel->make('files')->delete($link); $this->components->info("The [$link] link has been deleted."); } } /** * Get the symbolic links that are configured for the application. * * @return array */ protected function links() { return $this->laravel['config']['filesystems.links'] ?? [public_path('storage') => storage_path('app/public')]; } } PKO$W]Å}­�ll:src/Illuminate/Foundation/Console/ComponentMakeCommand.phpnu„[µü¤option('view')) { $this->writeView(function () { $this->components->info($this->type.' created successfully.'); }); return; } if (parent::handle() === false && ! $this->option('force')) { return false; } if (! $this->option('inline')) { $this->writeView(); } } /** * Write the view for the component. * * @param callable|null $onSuccess * @return void */ protected function writeView($onSuccess = null) { $path = $this->viewPath( str_replace('.', '/', 'components.'.$this->getView()).'.blade.php' ); if (! $this->files->isDirectory(dirname($path))) { $this->files->makeDirectory(dirname($path), 0777, true, true); } if ($this->files->exists($path) && ! $this->option('force')) { $this->components->error('View already exists.'); return; } file_put_contents( $path, '
' ); if ($onSuccess) { $onSuccess(); } } /** * Build the class with the given name. * * @param string $name * @return string */ protected function buildClass($name) { if ($this->option('inline')) { return str_replace( ['DummyView', '{{ view }}'], "<<<'blade'\n
\n \n
\nblade", parent::buildClass($name) ); } return str_replace( ['DummyView', '{{ view }}'], 'view(\'components.'.$this->getView().'\')', parent::buildClass($name) ); } /** * Get the view name relative to the components directory. * * @return string view */ protected function getView() { $name = str_replace('\\', '/', $this->argument('name')); return collect(explode('/', $name)) ->map(function ($part) { return Str::kebab($part); }) ->implode('.'); } /** * Get the stub file for the generator. * * @return string */ protected function getStub() { return $this->resolveStubPath('/stubs/view-component.stub'); } /** * Resolve the fully-qualified path to the stub. * * @param string $stub * @return string */ protected function resolveStubPath($stub) { return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) ? $customPath : __DIR__.$stub; } /** * Get the default namespace for the class. * * @param string $rootNamespace * @return string */ protected function getDefaultNamespace($rootNamespace) { return $rootNamespace.'\View\Components'; } /** * Get the console command options. * * @return array */ protected function getOptions() { return [ ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the component already exists'], ['inline', null, InputOption::VALUE_NONE, 'Create a component that renders an inline view'], ['view', null, InputOption::VALUE_NONE, 'Create an anonymous component with only a view'], ]; } } PKO$W]¹ì±-;-;6src/Illuminate/Foundation/Console/RouteListCommand.phpnu„[µü¤ 'red', 'GET' => 'blue', 'HEAD' => '#6C7280', 'OPTIONS' => '#6C7280', 'POST' => 'yellow', 'PUT' => 'yellow', 'PATCH' => 'yellow', 'DELETE' => 'red', ]; /** * Create a new route command instance. * * @param \Illuminate\Routing\Router $router * @return void */ public function __construct(Router $router) { parent::__construct(); $this->router = $router; } /** * Execute the console command. * * @return void */ public function handle() { if (! $this->output->isVeryVerbose()) { $this->router->flushMiddlewareGroups(); } if (! $this->router->getRoutes()->count()) { return $this->components->error("Your application doesn't have any routes."); } if (empty($routes = $this->getRoutes())) { return $this->components->error("Your application doesn't have any routes matching the given criteria."); } $this->displayRoutes($routes); } /** * Compile the routes into a displayable format. * * @return array */ protected function getRoutes() { $routes = collect($this->router->getRoutes())->map(function ($route) { return $this->getRouteInformation($route); })->filter()->all(); if (($sort = $this->option('sort')) !== null) { $routes = $this->sortRoutes($sort, $routes); } else { $routes = $this->sortRoutes('uri', $routes); } if ($this->option('reverse')) { $routes = array_reverse($routes); } return $this->pluckColumns($routes); } /** * Get the route information for a given route. * * @param \Illuminate\Routing\Route $route * @return array */ protected function getRouteInformation(Route $route) { return $this->filterRoute([ 'domain' => $route->domain(), 'method' => implode('|', $route->methods()), 'uri' => $route->uri(), 'name' => $route->getName(), 'action' => ltrim($route->getActionName(), '\\'), 'middleware' => $this->getMiddleware($route), 'vendor' => $this->isVendorRoute($route), ]); } /** * Sort the routes by a given element. * * @param string $sort * @param array $routes * @return array */ protected function sortRoutes($sort, array $routes) { return Arr::sort($routes, function ($route) use ($sort) { return $route[$sort]; }); } /** * Remove unnecessary columns from the routes. * * @param array $routes * @return array */ protected function pluckColumns(array $routes) { return array_map(function ($route) { return Arr::only($route, $this->getColumns()); }, $routes); } /** * Display the route information on the console. * * @param array $routes * @return void */ protected function displayRoutes(array $routes) { $routes = collect($routes); $this->output->writeln( $this->option('json') ? $this->asJson($routes) : $this->forCli($routes) ); } /** * Get the middleware for the route. * * @param \Illuminate\Routing\Route $route * @return string */ protected function getMiddleware($route) { return collect($this->router->gatherRouteMiddleware($route))->map(function ($middleware) { return $middleware instanceof Closure ? 'Closure' : $middleware; })->implode("\n"); } /** * Determine if the route has been defined outside of the application. * * @param \Illuminate\Routing\Route $route * @return bool */ protected function isVendorRoute(Route $route) { if ($route->action['uses'] instanceof Closure) { $path = (new ReflectionFunction($route->action['uses'])) ->getFileName(); } elseif (is_string($route->action['uses']) && str_contains($route->action['uses'], 'SerializableClosure')) { return false; } elseif (is_string($route->action['uses'])) { if ($this->isFrameworkController($route)) { return false; } $path = (new ReflectionClass($route->getControllerClass())) ->getFileName(); } else { return false; } return str_starts_with($path, base_path('vendor')); } /** * Determine if the route uses a framework controller. * * @param \Illuminate\Routing\Route $route * @return bool */ protected function isFrameworkController(Route $route) { return in_array($route->getControllerClass(), [ '\Illuminate\Routing\RedirectController', '\Illuminate\Routing\ViewController', ], true); } /** * Filter the route by URI and / or name. * * @param array $route * @return array|null */ protected function filterRoute(array $route) { if (($this->option('name') && ! Str::contains((string) $route['name'], $this->option('name'))) || ($this->option('path') && ! Str::contains($route['uri'], $this->option('path'))) || ($this->option('method') && ! Str::contains($route['method'], strtoupper($this->option('method')))) || ($this->option('domain') && ! Str::contains((string) $route['domain'], $this->option('domain'))) || ($this->option('except-vendor') && $route['vendor']) || ($this->option('only-vendor') && ! $route['vendor'])) { return; } if ($this->option('except-path')) { foreach (explode(',', $this->option('except-path')) as $path) { if (str_contains($route['uri'], $path)) { return; } } } return $route; } /** * Get the table headers for the visible columns. * * @return array */ protected function getHeaders() { return Arr::only($this->headers, array_keys($this->getColumns())); } /** * Get the column names to show (lowercase table headers). * * @return array */ protected function getColumns() { return array_map('strtolower', $this->headers); } /** * Parse the column list. * * @param array $columns * @return array */ protected function parseColumns(array $columns) { $results = []; foreach ($columns as $column) { if (str_contains($column, ',')) { $results = array_merge($results, explode(',', $column)); } else { $results[] = $column; } } return array_map('strtolower', $results); } /** * Convert the given routes to JSON. * * @param \Illuminate\Support\Collection $routes * @return string */ protected function asJson($routes) { return $routes ->map(function ($route) { $route['middleware'] = empty($route['middleware']) ? [] : explode("\n", $route['middleware']); return $route; }) ->values() ->toJson(); } /** * Convert the given routes to regular CLI output. * * @param \Illuminate\Support\Collection $routes * @return array */ protected function forCli($routes) { $routes = $routes->map( fn ($route) => array_merge($route, [ 'action' => $this->formatActionForCli($route), 'method' => $route['method'] == 'GET|HEAD|POST|PUT|PATCH|DELETE|OPTIONS' ? 'ANY' : $route['method'], 'uri' => $route['domain'] ? ($route['domain'].'/'.ltrim($route['uri'], '/')) : $route['uri'], ]), ); $maxMethod = mb_strlen($routes->max('method')); $terminalWidth = $this->getTerminalWidth(); $routeCount = $this->determineRouteCountOutput($routes, $terminalWidth); return $routes->map(function ($route) use ($maxMethod, $terminalWidth) { [ 'action' => $action, 'domain' => $domain, 'method' => $method, 'middleware' => $middleware, 'uri' => $uri, ] = $route; $middleware = Str::of($middleware)->explode("\n")->filter()->whenNotEmpty( fn ($collection) => $collection->map( fn ($middleware) => sprintf(' %s⇂ %s', str_repeat(' ', $maxMethod), $middleware) ) )->implode("\n"); $spaces = str_repeat(' ', max($maxMethod + 6 - mb_strlen($method), 0)); $dots = str_repeat('.', max( $terminalWidth - mb_strlen($method.$spaces.$uri.$action) - 6 - ($action ? 1 : 0), 0 )); $dots = empty($dots) ? $dots : " $dots"; if ($action && ! $this->output->isVerbose() && mb_strlen($method.$spaces.$uri.$action.$dots) > ($terminalWidth - 6)) { $action = substr($action, 0, $terminalWidth - 7 - mb_strlen($method.$spaces.$uri.$dots)).'…'; } $method = Str::of($method)->explode('|')->map( fn ($method) => sprintf('%s', $this->verbColors[$method] ?? 'default', $method), )->implode('|'); return [sprintf( ' %s %s%s%s %s', $method, $spaces, preg_replace('#({[^}]+})#', '$1', $uri), $dots, str_replace(' ', ' › ', $action ?? ''), ), $this->output->isVerbose() && ! empty($middleware) ? "$middleware" : null]; }) ->flatten() ->filter() ->prepend('') ->push('')->push($routeCount)->push('') ->toArray(); } /** * Get the formatted action for display on the CLI. * * @param array $route * @return string */ protected function formatActionForCli($route) { ['action' => $action, 'name' => $name] = $route; if ($action === 'Closure' || $action === ViewController::class) { return $name; } $name = $name ? "$name " : null; $rootControllerNamespace = $this->laravel[UrlGenerator::class]->getRootControllerNamespace() ?? ($this->laravel->getNamespace().'Http\\Controllers'); if (str_starts_with($action, $rootControllerNamespace)) { return $name.substr($action, mb_strlen($rootControllerNamespace) + 1); } $actionClass = explode('@', $action)[0]; if (class_exists($actionClass) && str_starts_with((new ReflectionClass($actionClass))->getFilename(), base_path('vendor'))) { $actionCollection = collect(explode('\\', $action)); return $name.$actionCollection->take(2)->implode('\\').' '.$actionCollection->last(); } return $name.$action; } /** * Determine and return the output for displaying the number of routes in the CLI output. * * @param \Illuminate\Support\Collection $routes * @param int $terminalWidth * @return string */ protected function determineRouteCountOutput($routes, $terminalWidth) { $routeCountText = 'Showing ['.$routes->count().'] routes'; $offset = $terminalWidth - mb_strlen($routeCountText) - 2; $spaces = str_repeat(' ', $offset); return $spaces.'Showing ['.$routes->count().'] routes'; } /** * Get the terminal width. * * @return int */ public static function getTerminalWidth() { return is_null(static::$terminalWidthResolver) ? (new Terminal)->getWidth() : call_user_func(static::$terminalWidthResolver); } /** * Set a callback that should be used when resolving the terminal width. * * @param \Closure|null $resolver * @return void */ public static function resolveTerminalWidthUsing($resolver) { static::$terminalWidthResolver = $resolver; } /** * Get the console command options. * * @return array */ protected function getOptions() { return [ ['json', null, InputOption::VALUE_NONE, 'Output the route list as JSON'], ['method', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by method'], ['name', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by name'], ['domain', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by domain'], ['path', null, InputOption::VALUE_OPTIONAL, 'Only show routes matching the given path pattern'], ['except-path', null, InputOption::VALUE_OPTIONAL, 'Do not display the routes matching the given path pattern'], ['reverse', 'r', InputOption::VALUE_NONE, 'Reverse the ordering of the routes'], ['sort', null, InputOption::VALUE_OPTIONAL, 'The column (domain, method, uri, name, action, middleware) to sort by', 'uri'], ['except-vendor', null, InputOption::VALUE_NONE, 'Do not display routes defined by vendor packages'], ['only-vendor', null, InputOption::VALUE_NONE, 'Only display routes defined by vendor packages'], ]; } } PKO$W]ú¦ ¢¢8src/Illuminate/Foundation/Console/ConfigClearCommand.phpnu„[µü¤files = $files; } /** * Execute the console command. * * @return void */ public function handle() { $this->files->delete($this->laravel->getCachedConfigPath()); $this->components->info('Configuration cache cleared successfully.'); } } PKO$W]u±.ìîî9src/Illuminate/Foundation/Console/ListenerMakeCommand.phpnu„[µü¤option('event') ?? ''; if (! Str::startsWith($event, [ $this->laravel->getNamespace(), 'Illuminate', '\\', ])) { $event = $this->laravel->getNamespace().'Events\\'.str_replace('/', '\\', $event); } $stub = str_replace( ['DummyEvent', '{{ event }}'], class_basename($event), parent::buildClass($name) ); return str_replace( ['DummyFullEvent', '{{ eventNamespace }}'], trim($event, '\\'), $stub ); } /** * Get the stub file for the generator. * * @return string */ protected function getStub() { if ($this->option('queued')) { return $this->option('event') ? __DIR__.'/stubs/listener-queued.stub' : __DIR__.'/stubs/listener-queued-duck.stub'; } return $this->option('event') ? __DIR__.'/stubs/listener.stub' : __DIR__.'/stubs/listener-duck.stub'; } /** * Determine if the class already exists. * * @param string $rawName * @return bool */ protected function alreadyExists($rawName) { return class_exists($rawName); } /** * Get the default namespace for the class. * * @param string $rootNamespace * @return string */ protected function getDefaultNamespace($rootNamespace) { return $rootNamespace.'\Listeners'; } /** * Get the console command options. * * @return array */ protected function getOptions() { return [ ['event', 'e', InputOption::VALUE_OPTIONAL, 'The event class being listened for'], ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the listener already exists'], ['queued', null, InputOption::VALUE_NONE, 'Indicates the event listener should be queued'], ]; } /** * Interact further with the user if they were prompted for missing arguments. * * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * @return void */ protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output) { if ($this->isReservedName($this->getNameInput()) || $this->didReceiveOptions($input)) { return; } $event = suggest( 'What event should be listened for? (Optional)', $this->possibleEvents(), ); if ($event) { $input->setOption('event', $event); } } } PKO$W]VxÿR  3src/Illuminate/Foundation/Console/QueuedCommand.phpnu„[µü¤data = $data; } /** * Handle the job. * * @param \Illuminate\Contracts\Console\Kernel $kernel * @return void */ public function handle(KernelContract $kernel) { $kernel->call(...array_values($this->data)); } /** * Get the display name for the queued job. * * @return string */ public function displayName() { return array_values($this->data)[0]; } } PKO$W]Ûc³¶pp5src/Illuminate/Foundation/Console/stubs/resource.stubnu„[µü¤ */ public function toArray(Request $request): array { return parent::toArray($request); } } PKO$W]�r'~bb6src/Illuminate/Foundation/Console/stubs/exception.stubnu„[µü¤ */ public function via(object $notifiable): array { return ['mail']; } /** * Get the mail representation of the notification. */ public function toMail(object $notifiable): MailMessage { return (new MailMessage)->markdown('{{ view }}'); } /** * Get the array representation of the notification. * * @return array */ public function toArray(object $notifiable): array { return [ // ]; } } PKO$W]SÈñ ´´;src/Illuminate/Foundation/Console/stubs/view-component.stubnu„[µü¤ */ public function via(object $notifiable): array { return ['mail']; } /** * Get the mail representation of the notification. */ public function toMail(object $notifiable): MailMessage { return (new MailMessage) ->line('The introduction to the notification.') ->action('Notification Action', url('/')) ->line('Thank you for using our application!'); } /** * Get the array representation of the notification. * * @return array */ public function toArray(object $notifiable): array { return [ // ]; } } PKO$W]þî•j!!=src/Illuminate/Foundation/Console/stubs/maintenance-mode.stubnu„[µü¤= time()) { return; } } // Redirect to the proper path if necessary... if (isset($data['redirect']) && $_SERVER['REQUEST_URI'] !== $data['redirect']) { http_response_code(302); header('Location: '.$data['redirect']); exit; } // Output the prerendered template... http_response_code($data['status'] ?? 503); if (isset($data['retry'])) { header('Retry-After: '.$data['retry']); } if (isset($data['refresh'])) { header('Refresh: '.$data['refresh']); } echo $data['template']; exit; PKO$W]¡� ¾¾<src/Illuminate/Foundation/Console/stubs/listener-queued.stubnu„[µü¤setCompiledRoutes( {{routes}} ); PKO$W]^�"d//2src/Illuminate/Foundation/Console/stubs/event.stubnu„[µü¤ */ public function broadcastOn(): array { return [ new PrivateChannel('channel-name'), ]; } } PKO$W]t>È�¯¯5src/Illuminate/Foundation/Console/stubs/markdown.stubnu„[µü¤ # Introduction The body of your message. Button Text Thanks,
{{ config('app.name') }}
PKO$W]`’ö&&1src/Illuminate/Foundation/Console/stubs/view.stubnu„[µü¤
PKO$W]GÐúÄÂÂ=src/Illuminate/Foundation/Console/stubs/exception-report.stubnu„[µü¤|string> */ public function rules(): array { return [ // ]; } } PKO$W]´Êí–@@;src/Illuminate/Foundation/Console/stubs/observer.plain.stubnu„[µü¤assertTrue(true); } } PKO$W]­]F½úú:src/Illuminate/Foundation/Console/stubs/markdown-mail.stubnu„[µü¤ */ public function attachments(): array { return []; } } PKO$W]Z”>žDD5src/Illuminate/Foundation/Console/stubs/provider.stubnu„[µü¤toBeTrue(); }); PKO$W]= Q��1src/Illuminate/Foundation/Console/stubs/cast.stubnu„[µü¤ $attributes */ public function get(Model $model, string $key, mixed $value, array $attributes): mixed { return $value; } /** * Prepare the given value for storage. * * @param array $attributes */ public function set(Model $model, string $key, mixed $value, array $attributes): mixed { return $value; } } PKO$W]Nyff2src/Illuminate/Foundation/Console/stubs/scope.stubnu„[µü¤get('/'); $response->assertStatus(200); }); PKO$W]z¯ÎØõõ1src/Illuminate/Foundation/Console/stubs/mail.stubnu„[µü¤ */ public function attachments(): array { return []; } } PKO$W]Ï]Y„ˆˆ6src/Illuminate/Foundation/Console/stubs/view.pest.stubnu„[µü¤view('{{ name }}', [ // ]); $contents->assertSee(''); }); PKO$W]к$›--7src/Illuminate/Foundation/Console/stubs/job.queued.stubnu„[µü¤src/Illuminate/Foundation/Console/stubs/model.morph-pivot.stubnu„[µü¤get('/'); $response->assertStatus(200); } } PKO$W]s|cc»»2src/Illuminate/Foundation/Console/stubs/model.stubnu„[µü¤view('{{ name }}', [ // ]); $contents->assertSee(''); } } PKO$W]OBß¹ææ4src/Illuminate/Foundation/Console/stubs/console.stubnu„[µü¤ */ public function toArray(Request $request): array { return parent::toArray($request); } } PKO$W]?Ïõ·ÇÇ9src/Illuminate/Foundation/Console/stubs/policy.plain.stubnu„[µü¤ $attributes */ public function set(Model $model, string $key, mixed $value, array $attributes): mixed { return $value; } } PKO$W]ëÎ� � 7src/Illuminate/Foundation/Console/ConfigShowCommand.phpnu„[µü¤argument('config'); if (! config()->has($config)) { $this->components->error("Configuration file `{$config}` does not exist."); return Command::FAILURE; } $this->newLine(); $this->render($config); $this->newLine(); return Command::SUCCESS; } /** * Render the configuration values. * * @param string $name * @return void */ public function render($name) { $data = config($name); if (! is_array($data)) { $this->title($name, $this->formatValue($data)); return; } $this->title($name); foreach (Arr::dot($data) as $key => $value) { $this->components->twoColumnDetail( $this->formatKey($key), $this->formatValue($value) ); } } /** * Render the title. * * @param string $title * @param string|null $subtitle * @return void */ public function title($title, $subtitle = null) { $this->components->twoColumnDetail( "{$title}", $subtitle, ); } /** * Format the given configuration key. * * @param string $key * @return string */ protected function formatKey($key) { return preg_replace_callback( '/(.*)\.(.*)$/', fn ($matches) => sprintf( '%s â‡� %s', str_replace('.', ' â‡� ', $matches[1]), $matches[2] ), $key ); } /** * Format the given configuration value. * * @param mixed $value * @return string */ protected function formatValue($value) { return match (true) { is_bool($value) => sprintf('%s', $value ? 'true' : 'false'), is_null($value) => 'null', is_numeric($value) => "{$value}", is_array($value) => '[]', is_object($value) => get_class($value), is_string($value) => $value, default => print_r($value, true), }; } } PKO$W]ø¾ˆ^¤¤8src/Illuminate/Foundation/Console/StubPublishCommand.phpnu„[µü¤laravel->basePath('stubs'))) { (new Filesystem)->makeDirectory($stubsPath); } $stubs = [ __DIR__.'/stubs/cast.inbound.stub' => 'cast.inbound.stub', __DIR__.'/stubs/cast.stub' => 'cast.stub', __DIR__.'/stubs/console.stub' => 'console.stub', __DIR__.'/stubs/event.stub' => 'event.stub', __DIR__.'/stubs/job.queued.stub' => 'job.queued.stub', __DIR__.'/stubs/job.stub' => 'job.stub', __DIR__.'/stubs/mail.stub' => 'mail.stub', __DIR__.'/stubs/markdown-mail.stub' => 'markdown-mail.stub', __DIR__.'/stubs/markdown-notification.stub' => 'markdown-notification.stub', __DIR__.'/stubs/model.pivot.stub' => 'model.pivot.stub', __DIR__.'/stubs/model.stub' => 'model.stub', __DIR__.'/stubs/notification.stub' => 'notification.stub', __DIR__.'/stubs/observer.plain.stub' => 'observer.plain.stub', __DIR__.'/stubs/observer.stub' => 'observer.stub', __DIR__.'/stubs/policy.plain.stub' => 'policy.plain.stub', __DIR__.'/stubs/policy.stub' => 'policy.stub', __DIR__.'/stubs/provider.stub' => 'provider.stub', __DIR__.'/stubs/request.stub' => 'request.stub', __DIR__.'/stubs/resource.stub' => 'resource.stub', __DIR__.'/stubs/resource-collection.stub' => 'resource-collection.stub', __DIR__.'/stubs/rule.stub' => 'rule.stub', __DIR__.'/stubs/scope.stub' => 'scope.stub', __DIR__.'/stubs/test.stub' => 'test.stub', __DIR__.'/stubs/test.unit.stub' => 'test.unit.stub', __DIR__.'/stubs/view-component.stub' => 'view-component.stub', realpath(__DIR__.'/../../Database/Console/Factories/stubs/factory.stub') => 'factory.stub', realpath(__DIR__.'/../../Database/Console/Seeds/stubs/seeder.stub') => 'seeder.stub', realpath(__DIR__.'/../../Database/Migrations/stubs/migration.create.stub') => 'migration.create.stub', realpath(__DIR__.'/../../Database/Migrations/stubs/migration.stub') => 'migration.stub', realpath(__DIR__.'/../../Database/Migrations/stubs/migration.update.stub') => 'migration.update.stub', realpath(__DIR__.'/../../Routing/Console/stubs/controller.api.stub') => 'controller.api.stub', realpath(__DIR__.'/../../Routing/Console/stubs/controller.invokable.stub') => 'controller.invokable.stub', realpath(__DIR__.'/../../Routing/Console/stubs/controller.model.api.stub') => 'controller.model.api.stub', realpath(__DIR__.'/../../Routing/Console/stubs/controller.model.stub') => 'controller.model.stub', realpath(__DIR__.'/../../Routing/Console/stubs/controller.nested.api.stub') => 'controller.nested.api.stub', realpath(__DIR__.'/../../Routing/Console/stubs/controller.nested.singleton.api.stub') => 'controller.nested.singleton.api.stub', realpath(__DIR__.'/../../Routing/Console/stubs/controller.nested.singleton.stub') => 'controller.nested.singleton.stub', realpath(__DIR__.'/../../Routing/Console/stubs/controller.nested.stub') => 'controller.nested.stub', realpath(__DIR__.'/../../Routing/Console/stubs/controller.plain.stub') => 'controller.plain.stub', realpath(__DIR__.'/../../Routing/Console/stubs/controller.singleton.api.stub') => 'controller.singleton.api.stub', realpath(__DIR__.'/../../Routing/Console/stubs/controller.singleton.stub') => 'controller.singleton.stub', realpath(__DIR__.'/../../Routing/Console/stubs/controller.stub') => 'controller.stub', realpath(__DIR__.'/../../Routing/Console/stubs/middleware.stub') => 'middleware.stub', ]; $this->laravel['events']->dispatch($event = new PublishingStubs($stubs)); foreach ($event->stubs as $from => $to) { $to = $stubsPath.DIRECTORY_SEPARATOR.ltrim($to, DIRECTORY_SEPARATOR); if ((! $this->option('existing') && (! file_exists($to) || $this->option('force'))) || ($this->option('existing') && file_exists($to))) { file_put_contents($to, file_get_contents($from)); } } $this->components->info('Stubs published successfully.'); } } PKO$W]‘6L+XX6src/Illuminate/Foundation/Console/ModelMakeCommand.phpnu„[µü¤option('force')) { return false; } if ($this->option('all')) { $this->input->setOption('factory', true); $this->input->setOption('seed', true); $this->input->setOption('migration', true); $this->input->setOption('controller', true); $this->input->setOption('policy', true); $this->input->setOption('resource', true); } if ($this->option('factory')) { $this->createFactory(); } if ($this->option('migration')) { $this->createMigration(); } if ($this->option('seed')) { $this->createSeeder(); } if ($this->option('controller') || $this->option('resource') || $this->option('api')) { $this->createController(); } if ($this->option('policy')) { $this->createPolicy(); } } /** * Create a model factory for the model. * * @return void */ protected function createFactory() { $factory = Str::studly($this->argument('name')); $this->call('make:factory', [ 'name' => "{$factory}Factory", '--model' => $this->qualifyClass($this->getNameInput()), ]); } /** * Create a migration file for the model. * * @return void */ protected function createMigration() { $table = Str::snake(Str::pluralStudly(class_basename($this->argument('name')))); if ($this->option('pivot')) { $table = Str::singular($table); } $this->call('make:migration', [ 'name' => "create_{$table}_table", '--create' => $table, ]); } /** * Create a seeder file for the model. * * @return void */ protected function createSeeder() { $seeder = Str::studly(class_basename($this->argument('name'))); $this->call('make:seeder', [ 'name' => "{$seeder}Seeder", ]); } /** * Create a controller for the model. * * @return void */ protected function createController() { $controller = Str::studly(class_basename($this->argument('name'))); $modelName = $this->qualifyClass($this->getNameInput()); $this->call('make:controller', array_filter([ 'name' => "{$controller}Controller", '--model' => $this->option('resource') || $this->option('api') ? $modelName : null, '--api' => $this->option('api'), '--requests' => $this->option('requests') || $this->option('all'), '--test' => $this->option('test'), '--pest' => $this->option('pest'), ])); } /** * Create a policy file for the model. * * @return void */ protected function createPolicy() { $policy = Str::studly(class_basename($this->argument('name'))); $this->call('make:policy', [ 'name' => "{$policy}Policy", '--model' => $this->qualifyClass($this->getNameInput()), ]); } /** * Get the stub file for the generator. * * @return string */ protected function getStub() { if ($this->option('pivot')) { return $this->resolveStubPath('/stubs/model.pivot.stub'); } if ($this->option('morph-pivot')) { return $this->resolveStubPath('/stubs/model.morph-pivot.stub'); } return $this->resolveStubPath('/stubs/model.stub'); } /** * Resolve the fully-qualified path to the stub. * * @param string $stub * @return string */ protected function resolveStubPath($stub) { return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) ? $customPath : __DIR__.$stub; } /** * Get the default namespace for the class. * * @param string $rootNamespace * @return string */ protected function getDefaultNamespace($rootNamespace) { return is_dir(app_path('Models')) ? $rootNamespace.'\\Models' : $rootNamespace; } /** * Get the console command options. * * @return array */ protected function getOptions() { return [ ['all', 'a', InputOption::VALUE_NONE, 'Generate a migration, seeder, factory, policy, resource controller, and form request classes for the model'], ['controller', 'c', InputOption::VALUE_NONE, 'Create a new controller for the model'], ['factory', 'f', InputOption::VALUE_NONE, 'Create a new factory for the model'], ['force', null, InputOption::VALUE_NONE, 'Create the class even if the model already exists'], ['migration', 'm', InputOption::VALUE_NONE, 'Create a new migration file for the model'], ['morph-pivot', null, InputOption::VALUE_NONE, 'Indicates if the generated model should be a custom polymorphic intermediate table model'], ['policy', null, InputOption::VALUE_NONE, 'Create a new policy for the model'], ['seed', 's', InputOption::VALUE_NONE, 'Create a new seeder for the model'], ['pivot', 'p', InputOption::VALUE_NONE, 'Indicates if the generated model should be a custom intermediate table model'], ['resource', 'r', InputOption::VALUE_NONE, 'Indicates if the generated controller should be a resource controller'], ['api', null, InputOption::VALUE_NONE, 'Indicates if the generated controller should be an API resource controller'], ['requests', 'R', InputOption::VALUE_NONE, 'Create new form request classes and use them in the resource controller'], ]; } /** * Interact further with the user if they were prompted for missing arguments. * * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * @return void */ protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output) { if ($this->isReservedName($this->getNameInput()) || $this->didReceiveOptions($input)) { return; } collect(multiselect('Would you like any of the following?', [ 'seed' => 'Database Seeder', 'factory' => 'Factory', 'requests' => 'Form Requests', 'migration' => 'Migration', 'policy' => 'Policy', 'resource' => 'Resource Controller', ]))->each(fn ($option) => $input->setOption($option, true)); } } PKO$W]*�úœ£ £ 8src/Illuminate/Foundation/Console/KeyGenerateCommand.phpnu„[µü¤generateRandomKey(); if ($this->option('show')) { return $this->line(''.$key.''); } // Next, we will replace the application key in the environment file so it is // automatically setup for this developer. This key gets generated using a // secure random byte generator and is later base64 encoded for storage. if (! $this->setKeyInEnvironmentFile($key)) { return; } $this->laravel['config']['app.key'] = $key; $this->components->info('Application key set successfully.'); } /** * Generate a random key for the application. * * @return string */ protected function generateRandomKey() { return 'base64:'.base64_encode( Encrypter::generateKey($this->laravel['config']['app.cipher']) ); } /** * Set the application key in the environment file. * * @param string $key * @return bool */ protected function setKeyInEnvironmentFile($key) { $currentKey = $this->laravel['config']['app.key']; if (strlen($currentKey) !== 0 && (! $this->confirmToProceed())) { return false; } if (! $this->writeNewEnvironmentFileWith($key)) { return false; } return true; } /** * Write a new environment file with the given key. * * @param string $key * @return bool */ protected function writeNewEnvironmentFileWith($key) { $replaced = preg_replace( $this->keyReplacementPattern(), 'APP_KEY='.$key, $input = file_get_contents($this->laravel->environmentFilePath()) ); if ($replaced === $input || $replaced === null) { $this->error('Unable to set application key. No APP_KEY variable was found in the .env file.'); return false; } file_put_contents($this->laravel->environmentFilePath(), $replaced); return true; } /** * Get a regex pattern that will match env APP_KEY with any random key. * * @return string */ protected function keyReplacementPattern() { $escaped = preg_quote('='.$this->laravel['config']['app.key'], '/'); return "/^APP_KEY{$escaped}/m"; } } PKO$W]×ól‚<src/Illuminate/Foundation/Console/PackageDiscoverCommand.phpnu„[µü¤components->info('Discovering packages'); $manifest->build(); collect($manifest->manifest) ->keys() ->each(fn ($description) => $this->components->task($description)) ->whenNotEmpty(fn () => $this->newLine()); } } PKO$W]¹<Ć” ” 9src/Illuminate/Foundation/Console/ResourceMakeCommand.phpnu„[µü¤collection()) { $this->type = 'Resource collection'; } parent::handle(); } /** * Get the stub file for the generator. * * @return string */ protected function getStub() { return $this->collection() ? $this->resolveStubPath('/stubs/resource-collection.stub') : $this->resolveStubPath('/stubs/resource.stub'); } /** * Determine if the command is generating a resource collection. * * @return bool */ protected function collection() { return $this->option('collection') || str_ends_with($this->argument('name'), 'Collection'); } /** * Resolve the fully-qualified path to the stub. * * @param string $stub * @return string */ protected function resolveStubPath($stub) { return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) ? $customPath : __DIR__.$stub; } /** * Get the default namespace for the class. * * @param string $rootNamespace * @return string */ protected function getDefaultNamespace($rootNamespace) { return $rootNamespace.'\Http\Resources'; } /** * Get the console command options. * * @return array */ protected function getOptions() { return [ ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the resource already exists'], ['collection', 'c', InputOption::VALUE_NONE, 'Create a resource collection'], ]; } } PKO$W]Â<ò::8src/Illuminate/Foundation/Console/StorageLinkCommand.phpnu„[µü¤option('relative'); foreach ($this->links() as $link => $target) { if (file_exists($link) && ! $this->isRemovableSymlink($link, $this->option('force'))) { $this->components->error("The [$link] link already exists."); continue; } if (is_link($link)) { $this->laravel->make('files')->delete($link); } if ($relative) { $this->laravel->make('files')->relativeLink($target, $link); } else { $this->laravel->make('files')->link($target, $link); } $this->components->info("The [$link] link has been connected to [$target]."); } } /** * Get the symbolic links that are configured for the application. * * @return array */ protected function links() { return $this->laravel['config']['filesystems.links'] ?? [public_path('storage') => storage_path('app/public')]; } /** * Determine if the provided path is a symlink that can be removed. * * @param string $link * @param bool $force * @return bool */ protected function isRemovableSymlink(string $link, bool $force): bool { return is_link($link) && $force; } } PKO$W]èϨ�6src/Illuminate/Foundation/Console/ViewClearCommand.phpnu„[µü¤files = $files; } /** * Execute the console command. * * @return void * * @throws \RuntimeException */ public function handle() { $path = $this->laravel['config']['view.compiled']; if (! $path) { throw new RuntimeException('View path not found.'); } $this->laravel['view.engine.resolver'] ->resolve('blade') ->forgetCompiledOrNotExpired(); foreach ($this->files->glob("{$path}/*") as $view) { $this->files->delete($view); } $this->components->info('Compiled views cleared successfully.'); } } PKO$W]¹resolveStubPath('/stubs/request.stub'); } /** * Resolve the fully-qualified path to the stub. * * @param string $stub * @return string */ protected function resolveStubPath($stub) { return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) ? $customPath : __DIR__.$stub; } /** * Get the default namespace for the class. * * @param string $rootNamespace * @return string */ protected function getDefaultNamespace($rootNamespace) { return $rootNamespace.'\Http\Requests'; } /** * Get the console command arguments. * * @return array */ protected function getOptions() { return [ ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the request already exists'], ]; } } PKO$W]žff:src/Illuminate/Foundation/Console/ExceptionMakeCommand.phpnu„[µü¤option('render')) { return $this->option('report') ? __DIR__.'/stubs/exception-render-report.stub' : __DIR__.'/stubs/exception-render.stub'; } return $this->option('report') ? __DIR__.'/stubs/exception-report.stub' : __DIR__.'/stubs/exception.stub'; } /** * Determine if the class already exists. * * @param string $rawName * @return bool */ protected function alreadyExists($rawName) { return class_exists($this->rootNamespace().'Exceptions\\'.$rawName); } /** * Get the default namespace for the class. * * @param string $rootNamespace * @return string */ protected function getDefaultNamespace($rootNamespace) { return $rootNamespace.'\Exceptions'; } /** * Get the console command options. * * @return array */ protected function getOptions() { return [ ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the exception already exists'], ['render', null, InputOption::VALUE_NONE, 'Create the exception with an empty render method'], ['report', null, InputOption::VALUE_NONE, 'Create the exception with an empty report method'], ]; } } PKO$W]õt ÞÝÝ5src/Illuminate/Foundation/Console/TestMakeCommand.phpnu„[µü¤option('unit') ? '.unit.stub' : '.stub'; return $this->option('pest') ? $this->resolveStubPath('/stubs/pest'.$suffix) : $this->resolveStubPath('/stubs/test'.$suffix); } /** * Resolve the fully-qualified path to the stub. * * @param string $stub * @return string */ protected function resolveStubPath($stub) { return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) ? $customPath : __DIR__.$stub; } /** * Get the destination class path. * * @param string $name * @return string */ protected function getPath($name) { $name = Str::replaceFirst($this->rootNamespace(), '', $name); return base_path('tests').str_replace('\\', '/', $name).'.php'; } /** * Get the default namespace for the class. * * @param string $rootNamespace * @return string */ protected function getDefaultNamespace($rootNamespace) { if ($this->option('unit')) { return $rootNamespace.'\Unit'; } else { return $rootNamespace.'\Feature'; } } /** * Get the root namespace for the class. * * @return string */ protected function rootNamespace() { return 'Tests'; } /** * Get the console command options. * * @return array */ protected function getOptions() { return [ ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the test already exists'], ['unit', 'u', InputOption::VALUE_NONE, 'Create a unit test'], ['pest', 'p', InputOption::VALUE_NONE, 'Create a Pest test'], ]; } /** * Interact further with the user if they were prompted for missing arguments. * * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * @return void */ protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output) { if ($this->isReservedName($this->getNameInput()) || $this->didReceiveOptions($input)) { return; } $type = select('Which type of test would you like?', [ 'feature' => 'Feature (PHPUnit)', 'unit' => 'Unit (PHPUnit)', 'pest-feature' => 'Feature (Pest)', 'pest-unit' => 'Unit (Pest)', ]); match ($type) { 'feature' => null, 'unit' => $input->setOption('unit', true), 'pest-feature' => $input->setOption('pest', true), 'pest-unit' => tap($input)->setOption('pest', true)->setOption('unit', true), }; } } PKO$W]jA�®ee1src/Illuminate/Foundation/Console/DownCommand.phpnu„[µü¤laravel->maintenanceMode()->active()) { $this->components->info('Application is already down.'); return 0; } $downFilePayload = $this->getDownFilePayload(); $this->laravel->maintenanceMode()->activate($downFilePayload); file_put_contents( storage_path('framework/maintenance.php'), file_get_contents(__DIR__.'/stubs/maintenance-mode.stub') ); $this->laravel->get('events')->dispatch(new MaintenanceModeEnabled()); $this->components->info('Application is now in maintenance mode.'); if ($downFilePayload['secret'] !== null) { $this->components->info('You may bypass maintenance mode via ['.config('app.url')."/{$downFilePayload['secret']}]."); } } catch (Exception $e) { $this->components->error(sprintf( 'Failed to enter maintenance mode: %s.', $e->getMessage(), )); return 1; } } /** * Get the payload to be placed in the "down" file. * * @return array */ protected function getDownFilePayload() { return [ 'except' => $this->excludedPaths(), 'redirect' => $this->redirectPath(), 'retry' => $this->getRetryTime(), 'refresh' => $this->option('refresh'), 'secret' => $this->getSecret(), 'status' => (int) $this->option('status', 503), 'template' => $this->option('render') ? $this->prerenderView() : null, ]; } /** * Get the paths that should be excluded from maintenance mode. * * @return array */ protected function excludedPaths() { try { return $this->laravel->make(PreventRequestsDuringMaintenance::class)->getExcludedPaths(); } catch (Throwable) { return []; } } /** * Get the path that users should be redirected to. * * @return string */ protected function redirectPath() { if ($this->option('redirect') && $this->option('redirect') !== '/') { return '/'.trim($this->option('redirect'), '/'); } return $this->option('redirect'); } /** * Prerender the specified view so that it can be rendered even before loading Composer. * * @return string */ protected function prerenderView() { (new RegisterErrorViewPaths)(); return view($this->option('render'), [ 'retryAfter' => $this->option('retry'), ])->render(); } /** * Get the number of seconds the client should wait before retrying their request. * * @return int|null */ protected function getRetryTime() { $retry = $this->option('retry'); return is_numeric($retry) && $retry > 0 ? (int) $retry : null; } /** * Get the secret phrase that may be used to bypass maintenance mode. * * @return string|null */ protected function getSecret() { return match (true) { ! is_null($this->option('secret')) => $this->option('secret'), $this->option('with-secret') => Str::random(), default => null, }; } } PKO$W]˜-0°°4src/Illuminate/Foundation/Console/ClosureCommand.phpnu„[µü¤callback = $callback; $this->signature = $signature; parent::__construct(); } /** * Execute the console command. * * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * @return int */ protected function execute(InputInterface $input, OutputInterface $output) { $inputs = array_merge($input->getArguments(), $input->getOptions()); $parameters = []; foreach ((new ReflectionFunction($this->callback))->getParameters() as $parameter) { if (isset($inputs[$parameter->getName()])) { $parameters[$parameter->getName()] = $inputs[$parameter->getName()]; } } return (int) $this->laravel->call( $this->callback->bindTo($this, $this), $parameters ); } /** * Set the description for the command. * * @param string $description * @return $this */ public function purpose($description) { return $this->describe($description); } /** * Set the description for the command. * * @param string $description * @return $this */ public function describe($description) { $this->setDescription($description); return $this; } } PKO$W] ¿L±ÜÜ5src/Illuminate/Foundation/Console/MailMakeCommand.phpnu„[µü¤option('force')) { return; } if ($this->option('markdown') !== false) { $this->writeMarkdownTemplate(); } } /** * Write the Markdown template for the mailable. * * @return void */ protected function writeMarkdownTemplate() { $path = $this->viewPath( str_replace('.', '/', $this->getView()).'.blade.php' ); if (! $this->files->isDirectory(dirname($path))) { $this->files->makeDirectory(dirname($path), 0755, true); } $this->files->put($path, file_get_contents(__DIR__.'/stubs/markdown.stub')); } /** * Build the class with the given name. * * @param string $name * @return string */ protected function buildClass($name) { $class = str_replace( '{{ subject }}', Str::headline(str_replace($this->getNamespace($name).'\\', '', $name)), parent::buildClass($name) ); if ($this->option('markdown') !== false) { $class = str_replace(['DummyView', '{{ view }}'], $this->getView(), $class); } return $class; } /** * Get the view name. * * @return string */ protected function getView() { $view = $this->option('markdown'); if (! $view) { $name = str_replace('\\', '/', $this->argument('name')); $view = 'mail.'.collect(explode('/', $name)) ->map(fn ($part) => Str::kebab($part)) ->implode('.'); } return $view; } /** * Get the stub file for the generator. * * @return string */ protected function getStub() { return $this->resolveStubPath( $this->option('markdown') !== false ? '/stubs/markdown-mail.stub' : '/stubs/mail.stub'); } /** * Resolve the fully-qualified path to the stub. * * @param string $stub * @return string */ protected function resolveStubPath($stub) { return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) ? $customPath : __DIR__.$stub; } /** * Get the default namespace for the class. * * @param string $rootNamespace * @return string */ protected function getDefaultNamespace($rootNamespace) { return $rootNamespace.'\Mail'; } /** * Get the console command options. * * @return array */ protected function getOptions() { return [ ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the mailable already exists'], ['markdown', 'm', InputOption::VALUE_OPTIONAL, 'Create a new Markdown template for the mailable', false], ]; } } PKO$W]*yŠ 7src/Illuminate/Foundation/Console/PolicyMakeCommand.phpnu„[µü¤replaceUserNamespace( parent::buildClass($name) ); $model = $this->option('model'); return $model ? $this->replaceModel($stub, $model) : $stub; } /** * Replace the User model namespace. * * @param string $stub * @return string */ protected function replaceUserNamespace($stub) { $model = $this->userProviderModel(); if (! $model) { return $stub; } return str_replace( $this->rootNamespace().'User', $model, $stub ); } /** * Get the model for the guard's user provider. * * @return string|null * * @throws \LogicException */ protected function userProviderModel() { $config = $this->laravel['config']; $guard = $this->option('guard') ?: $config->get('auth.defaults.guard'); if (is_null($guardProvider = $config->get('auth.guards.'.$guard.'.provider'))) { throw new LogicException('The ['.$guard.'] guard is not defined in your "auth" configuration file.'); } if (! $config->get('auth.providers.'.$guardProvider.'.model')) { return 'App\\Models\\User'; } return $config->get( 'auth.providers.'.$guardProvider.'.model' ); } /** * Replace the model for the given stub. * * @param string $stub * @param string $model * @return string */ protected function replaceModel($stub, $model) { $model = str_replace('/', '\\', $model); if (str_starts_with($model, '\\')) { $namespacedModel = trim($model, '\\'); } else { $namespacedModel = $this->qualifyModel($model); } $model = class_basename(trim($model, '\\')); $dummyUser = class_basename($this->userProviderModel()); $dummyModel = Str::camel($model) === 'user' ? 'model' : $model; $replace = [ 'NamespacedDummyModel' => $namespacedModel, '{{ namespacedModel }}' => $namespacedModel, '{{namespacedModel}}' => $namespacedModel, 'DummyModel' => $model, '{{ model }}' => $model, '{{model}}' => $model, 'dummyModel' => Str::camel($dummyModel), '{{ modelVariable }}' => Str::camel($dummyModel), '{{modelVariable}}' => Str::camel($dummyModel), 'DummyUser' => $dummyUser, '{{ user }}' => $dummyUser, '{{user}}' => $dummyUser, '$user' => '$'.Str::camel($dummyUser), ]; $stub = str_replace( array_keys($replace), array_values($replace), $stub ); return preg_replace( vsprintf('/use %s;[\r\n]+use %s;/', [ preg_quote($namespacedModel, '/'), preg_quote($namespacedModel, '/'), ]), "use {$namespacedModel};", $stub ); } /** * Get the stub file for the generator. * * @return string */ protected function getStub() { return $this->option('model') ? $this->resolveStubPath('/stubs/policy.stub') : $this->resolveStubPath('/stubs/policy.plain.stub'); } /** * Resolve the fully-qualified path to the stub. * * @param string $stub * @return string */ protected function resolveStubPath($stub) { return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) ? $customPath : __DIR__.$stub; } /** * Get the default namespace for the class. * * @param string $rootNamespace * @return string */ protected function getDefaultNamespace($rootNamespace) { return $rootNamespace.'\Policies'; } /** * Get the console command arguments. * * @return array */ protected function getOptions() { return [ ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the policy already exists'], ['model', 'm', InputOption::VALUE_OPTIONAL, 'The model that the policy applies to'], ['guard', 'g', InputOption::VALUE_OPTIONAL, 'The guard that the policy relies on'], ]; } /** * Interact further with the user if they were prompted for missing arguments. * * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * @return void */ protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output) { if ($this->isReservedName($this->getNameInput()) || $this->didReceiveOptions($input)) { return; } $model = suggest( 'What model should this policy apply to? (Optional)', $this->possibleModels(), ); if ($model) { $input->setOption('model', $model); } } } PKO$W]¹ÀYÎÎ6src/Illuminate/Foundation/Console/ScopeMakeCommand.phpnu„[µü¤resolveStubPath('/stubs/scope.stub'); } /** * Resolve the fully-qualified path to the stub. * * @param string $stub * @return string */ protected function resolveStubPath($stub) { return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) ? $customPath : __DIR__.$stub; } /** * Get the default namespace for the class. * * @param string $rootNamespace * @return string */ protected function getDefaultNamespace($rootNamespace) { return is_dir(app_path('Models')) ? $rootNamespace.'\\Models\\Scopes' : $rootNamespace.'\Scopes'; } /** * Get the console command arguments. * * @return array */ protected function getOptions() { return [ ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the scope already exists'], ]; } } PKO$W]=T·–5–51src/Illuminate/Foundation/Console/DocsCommand.phpnu„[µü¤php artisan docs -- search query here'; /** * The HTTP client instance. * * @var \Illuminate\Http\Client\Factory */ protected $http; /** * The cache repository implementation. * * @var \Illuminate\Contracts\Cache\Repository */ protected $cache; /** * The custom URL opener. * * @var callable|null */ protected $urlOpener; /** * The custom documentation version to open. * * @var string|null */ protected $version; /** * The operating system family. * * @var string */ protected $systemOsFamily = PHP_OS_FAMILY; /** * Configure the current command. * * @return void */ protected function configure() { parent::configure(); if ($this->isSearching()) { $this->ignoreValidationErrors(); } } /** * Execute the console command. * * @param \Illuminate\Http\Client\Factory $http * @param \Illuminate\Contracts\Cache\Repository $cache * @return int */ public function handle(Http $http, Cache $cache) { $this->http = $http; $this->cache = $cache; try { $this->openUrl(); } catch (ProcessFailedException $e) { if ($e->getProcess()->getExitCodeText() === 'Interrupt') { return $e->getProcess()->getExitCode(); } throw $e; } $this->refreshDocs(); return Command::SUCCESS; } /** * Open the documentation URL. * * @return void */ protected function openUrl() { with($this->url(), function ($url) { $this->components->info("Opening the docs to: {$url}"); $this->open($url); }); } /** * The URL to the documentation page. * * @return string */ protected function url() { if ($this->isSearching()) { return "https://laravel.com/docs/{$this->version()}?".Arr::query([ 'q' => $this->searchQuery(), ]); } return with($this->page(), function ($page) { return trim("https://laravel.com/docs/{$this->version()}/{$page}#{$this->section($page)}", '#/'); }); } /** * The page the user is opening. * * @return string */ protected function page() { return with($this->resolvePage(), function ($page) { if ($page === null) { $this->components->warn('Unable to determine the page you are trying to visit.'); return '/'; } return $page; }); } /** * Determine the page to open. * * @return string|null */ protected function resolvePage() { if ($this->option('no-interaction') && $this->didNotRequestPage()) { return '/'; } return $this->didNotRequestPage() ? $this->askForPage() : $this->guessPage($this->argument('page')); } /** * Determine if the user requested a specific page when calling the command. * * @return bool */ protected function didNotRequestPage() { return $this->argument('page') === null; } /** * Ask the user which page they would like to open. * * @return string|null */ protected function askForPage() { return $this->askForPageViaCustomStrategy() ?? $this->askForPageViaAutocomplete(); } /** * Ask the user which page they would like to open via a custom strategy. * * @return string|null */ protected function askForPageViaCustomStrategy() { try { $strategy = require Env::get('ARTISAN_DOCS_ASK_STRATEGY'); } catch (Throwable) { return null; } if (! is_callable($strategy)) { return null; } return $strategy($this) ?? '/'; } /** * Ask the user which page they would like to open using autocomplete. * * @return string|null */ protected function askForPageViaAutocomplete() { $choice = suggest( label: 'Which page would you like to open?', options: fn ($value) => $this->pages() ->mapWithKeys(fn ($option) => [ Str::lower($option['title']) => $option['title'], ]) ->filter(fn ($title) => str_contains(Str::lower($title), Str::lower($value))) ->all(), placeholder: 'E.g. Collections' ); return $this->pages()->filter( fn ($page) => $page['title'] === $choice || Str::lower($page['title']) === $choice )->keys()->first() ?: $this->guessPage($choice); } /** * Guess the page the user is attempting to open. * * @return string|null */ protected function guessPage($search) { return $this->pages() ->filter(fn ($page) => str_starts_with( Str::slug($page['title'], ' '), Str::slug($search, ' ') ))->keys()->first() ?? $this->pages()->map(fn ($page) => similar_text( Str::slug($page['title'], ' '), Str::slug($search, ' '), )) ->filter(fn ($score) => $score >= min(3, Str::length($search))) ->sortDesc() ->keys() ->sortByDesc(fn ($slug) => Str::contains( Str::slug($this->pages()[$slug]['title'], ' '), Str::slug($search, ' ') ) ? 1 : 0) ->first(); } /** * The section the user specifically asked to open. * * @param string $page * @return string|null */ protected function section($page) { return $this->didNotRequestSection() ? null : $this->guessSection($page); } /** * Determine if the user requested a specific section when calling the command. * * @return bool */ protected function didNotRequestSection() { return $this->argument('section') === null; } /** * Guess the section the user is attempting to open. * * @param string $page * @return string|null */ protected function guessSection($page) { return $this->sectionsFor($page) ->filter(fn ($section) => str_starts_with( Str::slug($section['title'], ' '), Str::slug($this->argument('section'), ' ') ))->keys()->first() ?? $this->sectionsFor($page)->map(fn ($section) => similar_text( Str::slug($section['title'], ' '), Str::slug($this->argument('section'), ' '), )) ->filter(fn ($score) => $score >= min(3, Str::length($this->argument('section')))) ->sortDesc() ->keys() ->sortByDesc(fn ($slug) => Str::contains( Str::slug($this->sectionsFor($page)[$slug]['title'], ' '), Str::slug($this->argument('section'), ' ') ) ? 1 : 0) ->first(); } /** * Open the URL in the user's browser. * * @param string $url * @return void */ protected function open($url) { ($this->urlOpener ?? function ($url) { if (Env::get('ARTISAN_DOCS_OPEN_STRATEGY')) { $this->openViaCustomStrategy($url); } elseif (in_array($this->systemOsFamily, ['Darwin', 'Windows', 'Linux'])) { $this->openViaBuiltInStrategy($url); } else { $this->components->warn('Unable to open the URL on your system. You will need to open it yourself or create a custom opener for your system.'); } })($url); } /** * Open the URL via a custom strategy. * * @param string $url * @return void */ protected function openViaCustomStrategy($url) { try { $command = require Env::get('ARTISAN_DOCS_OPEN_STRATEGY'); } catch (Throwable) { $command = null; } if (! is_callable($command)) { $this->components->warn('Unable to open the URL with your custom strategy. You will need to open it yourself.'); return; } $command($url); } /** * Open the URL via the built in strategy. * * @param string $url * @return void */ protected function openViaBuiltInStrategy($url) { if ($this->systemOsFamily === 'Windows') { $process = tap(Process::fromShellCommandline(escapeshellcmd("start {$url}")))->run(); if (! $process->isSuccessful()) { throw new ProcessFailedException($process); } return; } $binary = Collection::make(match ($this->systemOsFamily) { 'Darwin' => ['open'], 'Linux' => ['xdg-open', 'wslview'], })->first(fn ($binary) => (new ExecutableFinder)->find($binary) !== null); if ($binary === null) { $this->components->warn('Unable to open the URL on your system. You will need to open it yourself or create a custom opener for your system.'); return; } $process = tap(Process::fromShellCommandline(escapeshellcmd("{$binary} {$url}")))->run(); if (! $process->isSuccessful()) { throw new ProcessFailedException($process); } } /** * The available sections for the page. * * @param string $page * @return \Illuminate\Support\Collection */ public function sectionsFor($page) { return new Collection($this->pages()[$page]['sections']); } /** * The pages available to open. * * @return \Illuminate\Support\Collection */ public function pages() { return new Collection($this->docs()['pages']); } /** * Get the documentation index as a collection. * * @return \Illuminate\Support\Collection */ public function docs() { return $this->cache->remember( "artisan.docs.{{$this->version()}}.index", CarbonInterval::months(2), fn () => $this->fetchDocs()->throw()->collect() ); } /** * Refresh the cached copy of the documentation index. * * @return void */ protected function refreshDocs() { with($this->fetchDocs(), function ($response) { if ($response->successful()) { $this->cache->put("artisan.docs.{{$this->version()}}.index", $response->collect(), CarbonInterval::months(2)); } }); } /** * Fetch the documentation index from the Laravel website. * * @return \Illuminate\Http\Client\Response */ protected function fetchDocs() { return $this->http->get("https://laravel.com/docs/{$this->version()}/index.json"); } /** * Determine the version of the docs to open. * * @return string */ protected function version() { return Str::before($this->version ?? $this->laravel->version(), '.').'.x'; } /** * The search query the user provided. * * @return string */ protected function searchQuery() { return Collection::make($_SERVER['argv'])->skip(3)->implode(' '); } /** * Determine if the command is intended to perform a search. * * @return bool */ protected function isSearching() { return ($_SERVER['argv'][2] ?? null) === '--'; } /** * Set the documentation version. * * @param string $version * @return $this */ public function setVersion($version) { $this->version = $version; return $this; } /** * Set a custom URL opener. * * @param callable|null $opener * @return $this */ public function setUrlOpener($opener) { $this->urlOpener = $opener; return $this; } /** * Set the system operating system family. * * @param string $family * @return $this */ public function setSystemOsFamily($family) { $this->systemOsFamily = $family; return $this; } } PKO$W]HÞÖ­­9src/Illuminate/Foundation/Console/ProviderMakeCommand.phpnu„[µü¤resolveStubPath('/stubs/provider.stub'); } /** * Resolve the fully-qualified path to the stub. * * @param string $stub * @return string */ protected function resolveStubPath($stub) { return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) ? $customPath : __DIR__.$stub; } /** * Get the default namespace for the class. * * @param string $rootNamespace * @return string */ protected function getDefaultNamespace($rootNamespace) { return $rootNamespace.'\Providers'; } /** * Get the console command arguments. * * @return array */ protected function getOptions() { return [ ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the provider already exists'], ]; } } PKO$W]½96ÂÂ4src/Illuminate/Foundation/Console/JobMakeCommand.phpnu„[µü¤option('sync') ? $this->resolveStubPath('/stubs/job.stub') : $this->resolveStubPath('/stubs/job.queued.stub'); } /** * Resolve the fully-qualified path to the stub. * * @param string $stub * @return string */ protected function resolveStubPath($stub) { return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) ? $customPath : __DIR__.$stub; } /** * Get the default namespace for the class. * * @param string $rootNamespace * @return string */ protected function getDefaultNamespace($rootNamespace) { return $rootNamespace.'\Jobs'; } /** * Get the console command options. * * @return array */ protected function getOptions() { return [ ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the job already exists'], ['sync', null, InputOption::VALUE_NONE, 'Indicates that job should be synchronous'], ]; } } PKO$W]¢owÚì ì /src/Illuminate/Foundation/Console/CliDumper.phpnu„[µü¤basePath = $basePath; $this->output = $output; $this->compiledViewPath = $compiledViewPath; } /** * Create a new CLI dumper instance and register it as the default dumper. * * @param string $basePath * @param string $compiledViewPath * @return void */ public static function register($basePath, $compiledViewPath) { $cloner = tap(new VarCloner())->addCasters(ReflectionCaster::UNSET_CLOSURE_FILE_INFO); $dumper = new static(new ConsoleOutput(), $basePath, $compiledViewPath); VarDumper::setHandler(fn ($value) => $dumper->dumpWithSource($cloner->cloneVar($value))); } /** * Dump a variable with its source file / line. * * @param \Symfony\Component\VarDumper\Cloner\Data $data * @return void */ public function dumpWithSource(Data $data) { if ($this->dumping) { $this->dump($data); return; } $this->dumping = true; $output = (string) $this->dump($data, true); $lines = explode("\n", $output); $lines[array_key_last($lines) - 1] .= $this->getDumpSourceContent(); $this->output->write(implode("\n", $lines)); $this->dumping = false; } /** * Get the dump's source console content. * * @return string */ protected function getDumpSourceContent() { if (is_null($dumpSource = $this->resolveDumpSource())) { return ''; } [$file, $relativeFile, $line] = $dumpSource; $href = $this->resolveSourceHref($file, $line); return sprintf( ' // %s%s', is_null($href) ? '' : ";href=$href", $relativeFile, is_null($line) ? '' : ":$line" ); } /** * {@inheritDoc} */ protected function supportsColors(): bool { return $this->output->isDecorated(); } } PKO$W],Å�á8á8,src/Illuminate/Foundation/Console/Kernel.phpnu„[µü¤app = $app; $this->events = $events; $this->app->booted(function () { if (! $this->app->runningUnitTests()) { $this->rerouteSymfonyCommandEvents(); } $this->defineConsoleSchedule(); }); } /** * Re-route the Symfony command events to their Laravel counterparts. * * @internal * * @return $this */ public function rerouteSymfonyCommandEvents() { if (is_null($this->symfonyDispatcher)) { $this->symfonyDispatcher = new EventDispatcher; $this->symfonyDispatcher->addListener(ConsoleEvents::COMMAND, function (ConsoleCommandEvent $event) { $this->events->dispatch( new CommandStarting($event->getCommand()->getName(), $event->getInput(), $event->getOutput()) ); }); $this->symfonyDispatcher->addListener(ConsoleEvents::TERMINATE, function (ConsoleTerminateEvent $event) { $this->events->dispatch( new CommandFinished($event->getCommand()->getName(), $event->getInput(), $event->getOutput(), $event->getExitCode()) ); }); } return $this; } /** * Define the application's command schedule. * * @return void */ protected function defineConsoleSchedule() { $this->app->singleton(Schedule::class, function ($app) { return tap(new Schedule($this->scheduleTimezone()), function ($schedule) { $this->schedule($schedule->useCache($this->scheduleCache())); }); }); } /** * Get the name of the cache store that should manage scheduling mutexes. * * @return string */ protected function scheduleCache() { return $this->app['config']->get('cache.schedule_store', Env::get('SCHEDULE_CACHE_DRIVER')); } /** * Run the console application. * * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface|null $output * @return int */ public function handle($input, $output = null) { $this->commandStartedAt = Carbon::now(); try { if (in_array($input->getFirstArgument(), ['env:encrypt', 'env:decrypt'], true)) { $this->bootstrapWithoutBootingProviders(); } $this->bootstrap(); return $this->getArtisan()->run($input, $output); } catch (Throwable $e) { $this->reportException($e); $this->renderException($output, $e); return 1; } } /** * Terminate the application. * * @param \Symfony\Component\Console\Input\InputInterface $input * @param int $status * @return void */ public function terminate($input, $status) { $this->app->terminate(); if ($this->commandStartedAt === null) { return; } $this->commandStartedAt->setTimezone($this->app['config']->get('app.timezone') ?? 'UTC'); foreach ($this->commandLifecycleDurationHandlers as ['threshold' => $threshold, 'handler' => $handler]) { $end ??= Carbon::now(); if ($this->commandStartedAt->diffInMilliseconds($end) > $threshold) { $handler($this->commandStartedAt, $input, $status); } } $this->commandStartedAt = null; } /** * Register a callback to be invoked when the command lifecycle duration exceeds a given amount of time. * * @param \DateTimeInterface|\Carbon\CarbonInterval|float|int $threshold * @param callable $handler * @return void */ public function whenCommandLifecycleIsLongerThan($threshold, $handler) { $threshold = $threshold instanceof DateTimeInterface ? $this->secondsUntil($threshold) * 1000 : $threshold; $threshold = $threshold instanceof CarbonInterval ? $threshold->totalMilliseconds : $threshold; $this->commandLifecycleDurationHandlers[] = [ 'threshold' => $threshold, 'handler' => $handler, ]; } /** * When the command being handled started. * * @return \Illuminate\Support\Carbon|null */ public function commandStartedAt() { return $this->commandStartedAt; } /** * Define the application's command schedule. * * @param \Illuminate\Console\Scheduling\Schedule $schedule * @return void */ protected function schedule(Schedule $schedule) { // } /** * Get the timezone that should be used by default for scheduled events. * * @return \DateTimeZone|string|null */ protected function scheduleTimezone() { $config = $this->app['config']; return $config->get('app.schedule_timezone', $config->get('app.timezone')); } /** * Register the commands for the application. * * @return void */ protected function commands() { // } /** * Register a Closure based command with the application. * * @param string $signature * @param \Closure $callback * @return \Illuminate\Foundation\Console\ClosureCommand */ public function command($signature, Closure $callback) { $command = new ClosureCommand($signature, $callback); Artisan::starting(function ($artisan) use ($command) { $artisan->add($command); }); return $command; } /** * Register all of the commands in the given directory. * * @param array|string $paths * @return void */ protected function load($paths) { $paths = array_unique(Arr::wrap($paths)); $paths = array_filter($paths, function ($path) { return is_dir($path); }); if (empty($paths)) { return; } $namespace = $this->app->getNamespace(); foreach (Finder::create()->in($paths)->files() as $file) { $command = $this->commandClassFromFile($file, $namespace); if (is_subclass_of($command, Command::class) && ! (new ReflectionClass($command))->isAbstract()) { Artisan::starting(function ($artisan) use ($command) { $artisan->resolve($command); }); } } } /** * Extract the command class name from the given file path. * * @param \SplFileInfo $file * @param string $namespace * @return string */ protected function commandClassFromFile(SplFileInfo $file, string $namespace): string { return $namespace.str_replace( ['/', '.php'], ['\\', ''], Str::after($file->getRealPath(), realpath(app_path()).DIRECTORY_SEPARATOR) ); } /** * Register the given command with the console application. * * @param \Symfony\Component\Console\Command\Command $command * @return void */ public function registerCommand($command) { $this->getArtisan()->add($command); } /** * Run an Artisan console command by name. * * @param string $command * @param array $parameters * @param \Symfony\Component\Console\Output\OutputInterface|null $outputBuffer * @return int * * @throws \Symfony\Component\Console\Exception\CommandNotFoundException */ public function call($command, array $parameters = [], $outputBuffer = null) { if (in_array($command, ['env:encrypt', 'env:decrypt'], true)) { $this->bootstrapWithoutBootingProviders(); } $this->bootstrap(); return $this->getArtisan()->call($command, $parameters, $outputBuffer); } /** * Queue the given console command. * * @param string $command * @param array $parameters * @return \Illuminate\Foundation\Bus\PendingDispatch */ public function queue($command, array $parameters = []) { return QueuedCommand::dispatch(func_get_args()); } /** * Get all of the commands registered with the console. * * @return array */ public function all() { $this->bootstrap(); return $this->getArtisan()->all(); } /** * Get the output for the last run command. * * @return string */ public function output() { $this->bootstrap(); return $this->getArtisan()->output(); } /** * Bootstrap the application for artisan commands. * * @return void */ public function bootstrap() { if (! $this->app->hasBeenBootstrapped()) { $this->app->bootstrapWith($this->bootstrappers()); } $this->app->loadDeferredProviders(); if (! $this->commandsLoaded) { $this->commands(); $this->commandsLoaded = true; } } /** * Bootstrap the application without booting service providers. * * @return void */ public function bootstrapWithoutBootingProviders() { $this->app->bootstrapWith( collect($this->bootstrappers())->reject(function ($bootstrapper) { return $bootstrapper === \Illuminate\Foundation\Bootstrap\BootProviders::class; })->all() ); } /** * Get the Artisan application instance. * * @return \Illuminate\Console\Application */ protected function getArtisan() { if (is_null($this->artisan)) { $this->artisan = (new Artisan($this->app, $this->events, $this->app->version())) ->resolveCommands($this->commands) ->setContainerCommandLoader(); if ($this->symfonyDispatcher instanceof EventDispatcher) { $this->artisan->setDispatcher($this->symfonyDispatcher); $this->artisan->setSignalsToDispatchEvent(); } } return $this->artisan; } /** * Set the Artisan application instance. * * @param \Illuminate\Console\Application|null $artisan * @return void */ public function setArtisan($artisan) { $this->artisan = $artisan; } /** * Get the bootstrap classes for the application. * * @return array */ protected function bootstrappers() { return $this->bootstrappers; } /** * Report the exception to the exception handler. * * @param \Throwable $e * @return void */ protected function reportException(Throwable $e) { $this->app[ExceptionHandler::class]->report($e); } /** * Render the given exception. * * @param \Symfony\Component\Console\Output\OutputInterface $output * @param \Throwable $e * @return void */ protected function renderException($output, Throwable $e) { $this->app[ExceptionHandler::class]->renderForConsole($output, $e); } } PKO$W]í¨—(ÃÃ7src/Illuminate/Foundation/Console/EventClearCommand.phpnu„[µü¤files = $files; } /** * Execute the console command. * * @return void * * @throws \RuntimeException */ public function handle() { $this->files->delete($this->laravel->getCachedEventsPath()); $this->components->info('Cached events cleared successfully.'); } } PKO$W]eÒ±±:src/Illuminate/Foundation/Console/EventGenerateCommand.phpnu„[µü¤laravel->getProviders(EventServiceProvider::class); foreach ($providers as $provider) { foreach ($provider->listens() as $event => $listeners) { $this->makeEventAndListeners($event, $listeners); } } $this->components->info('Events and listeners generated successfully.'); } /** * Make the event and listeners for the given event. * * @param string $event * @param array $listeners * @return void */ protected function makeEventAndListeners($event, $listeners) { if (! str_contains($event, '\\')) { return; } $this->callSilent('make:event', ['name' => $event]); $this->makeListeners($event, $listeners); } /** * Make the listeners for the given event. * * @param string $event * @param array $listeners * @return void */ protected function makeListeners($event, $listeners) { foreach ($listeners as $listener) { $listener = preg_replace('/@.+$/', '', $listener); $this->callSilent('make:listener', array_filter( ['name' => $listener, '--event' => $event] )); } } } PKO$W]j&ýkk?src/Illuminate/Foundation/Console/EnvironmentDecryptCommand.phpnu„[µü¤files = $files; } /** * Execute the console command. * * @return void */ public function handle() { $key = $this->option('key') ?: Env::get('LARAVEL_ENV_ENCRYPTION_KEY'); if (! $key) { $this->components->error('A decryption key is required.'); return Command::FAILURE; } $cipher = $this->option('cipher') ?: 'AES-256-CBC'; $key = $this->parseKey($key); $encryptedFile = ($this->option('env') ? base_path('.env').'.'.$this->option('env') : $this->laravel->environmentFilePath()).'.encrypted'; $outputFile = $this->outputFilePath(); if (Str::endsWith($outputFile, '.encrypted')) { $this->components->error('Invalid filename.'); return Command::FAILURE; } if (! $this->files->exists($encryptedFile)) { $this->components->error('Encrypted environment file not found.'); return Command::FAILURE; } if ($this->files->exists($outputFile) && ! $this->option('force')) { $this->components->error('Environment file already exists.'); return Command::FAILURE; } try { $encrypter = new Encrypter($key, $cipher); $this->files->put( $outputFile, $encrypter->decrypt($this->files->get($encryptedFile)) ); } catch (Exception $e) { $this->components->error($e->getMessage()); return Command::FAILURE; } $this->components->info('Environment successfully decrypted.'); $this->components->twoColumnDetail('Decrypted file', $outputFile); $this->newLine(); } /** * Parse the encryption key. * * @param string $key * @return string */ protected function parseKey(string $key) { if (Str::startsWith($key, $prefix = 'base64:')) { $key = base64_decode(Str::after($key, $prefix)); } return $key; } /** * Get the output file path that should be used for the command. * * @return string */ protected function outputFilePath() { $path = Str::finish($this->option('path') ?: base_path(), DIRECTORY_SEPARATOR); $outputFile = $this->option('filename') ?: ('.env'.($this->option('env') ? '.'.$this->option('env') : '')); $outputFile = ltrim($outputFile, DIRECTORY_SEPARATOR); return $path.$outputFile; } } PKO$W]×YR7src/Illuminate/Foundation/Console/RouteClearCommand.phpnu„[µü¤files = $files; } /** * Execute the console command. * * @return void */ public function handle() { $this->files->delete($this->laravel->getCachedRoutesPath()); $this->components->info('Route cache cleared successfully.'); } } PKO$W]£.gX± ± =src/Illuminate/Foundation/Console/NotificationMakeCommand.phpnu„[µü¤option('force')) { return; } if ($this->option('markdown')) { $this->writeMarkdownTemplate(); } } /** * Write the Markdown template for the mailable. * * @return void */ protected function writeMarkdownTemplate() { $path = $this->viewPath( str_replace('.', '/', $this->option('markdown')).'.blade.php' ); if (! $this->files->isDirectory(dirname($path))) { $this->files->makeDirectory(dirname($path), 0755, true); } $this->files->put($path, file_get_contents(__DIR__.'/stubs/markdown.stub')); } /** * Build the class with the given name. * * @param string $name * @return string */ protected function buildClass($name) { $class = parent::buildClass($name); if ($this->option('markdown')) { $class = str_replace(['DummyView', '{{ view }}'], $this->option('markdown'), $class); } return $class; } /** * Get the stub file for the generator. * * @return string */ protected function getStub() { return $this->option('markdown') ? $this->resolveStubPath('/stubs/markdown-notification.stub') : $this->resolveStubPath('/stubs/notification.stub'); } /** * Resolve the fully-qualified path to the stub. * * @param string $stub * @return string */ protected function resolveStubPath($stub) { return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) ? $customPath : __DIR__.$stub; } /** * Get the default namespace for the class. * * @param string $rootNamespace * @return string */ protected function getDefaultNamespace($rootNamespace) { return $rootNamespace.'\Notifications'; } /** * Get the console command options. * * @return array */ protected function getOptions() { return [ ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the notification already exists'], ['markdown', 'm', InputOption::VALUE_OPTIONAL, 'Create a new Markdown template for the notification'], ]; } } PKO$W]kÀνYY5src/Illuminate/Foundation/Console/ViewMakeCommand.phpnu„[µü¤random(), $contents, ); } /** * Get the destination view path. * * @param string $name * @return string */ protected function getPath($name) { return $this->viewPath( $this->getNameInput().'.'.$this->option('extension'), ); } /** * Get the desired view name from the input. * * @return string */ protected function getNameInput() { $name = trim($this->argument('name')); $name = str_replace(['\\', '.'], '/', $this->argument('name')); return $name; } /** * Get the stub file for the generator. * * @return string */ protected function getStub() { return $this->resolveStubPath( '/stubs/view.stub', ); } /** * Resolve the fully-qualified path to the stub. * * @param string $stub * @return string */ protected function resolveStubPath($stub) { return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) ? $customPath : __DIR__.$stub; } /** * Get the destination test case path. * * @return string */ protected function getTestPath() { return base_path( Str::of($this->testClassFullyQualifiedName()) ->replace('\\', '/') ->replaceFirst('Tests/Feature', 'tests/Feature') ->append('Test.php') ->value() ); } /** * Create the matching test case if requested. * * @param string $path */ protected function handleTestCreation($path): bool { if (! $this->option('test') && ! $this->option('pest')) { return false; } $contents = preg_replace( ['/\{{ namespace \}}/', '/\{{ class \}}/', '/\{{ name \}}/'], [$this->testNamespace(), $this->testClassName(), $this->testViewName()], File::get($this->getTestStub()), ); File::ensureDirectoryExists(dirname($this->getTestPath()), 0755, true); return File::put($this->getTestPath(), $contents); } /** * Get the namespace for the test. * * @return string */ protected function testNamespace() { return Str::of($this->testClassFullyQualifiedName()) ->beforeLast('\\') ->value(); } /** * Get the class name for the test. * * @return string */ protected function testClassName() { return Str::of($this->testClassFullyQualifiedName()) ->afterLast('\\') ->append('Test') ->value(); } /** * Get the class fully qualified name for the test. * * @return string */ protected function testClassFullyQualifiedName() { $name = Str::of(Str::lower($this->getNameInput()))->replace('.'.$this->option('extension'), ''); $namespacedName = Str::of( Str::of($name) ->replace('/', ' ') ->explode(' ') ->map(fn ($part) => Str::of($part)->ucfirst()) ->implode('\\') ) ->replace(['-', '_'], ' ') ->explode(' ') ->map(fn ($part) => Str::of($part)->ucfirst()) ->implode(''); return 'Tests\\Feature\\View\\'.$namespacedName; } /** * Get the test stub file for the generator. * * @return string */ protected function getTestStub() { $stubName = 'view.'.($this->option('pest') ? 'pest' : 'test').'.stub'; return file_exists($customPath = $this->laravel->basePath("stubs/$stubName")) ? $customPath : __DIR__.'/stubs/'.$stubName; } /** * Get the view name for the test. * * @return string */ protected function testViewName() { return Str::of($this->getNameInput()) ->replace('/', '.') ->lower() ->value(); } /** * Get the console command arguments. * * @return array */ protected function getOptions() { return [ ['extension', null, InputOption::VALUE_OPTIONAL, 'The extension of the generated view', 'blade.php'], ['force', 'f', InputOption::VALUE_NONE, 'Create the view even if the view already exists'], ]; } } PKO$W]Åpϼ¬¬9src/Illuminate/Foundation/Console/ObserverMakeCommand.phpnu„[µü¤option('model'); return $model ? $this->replaceModel($stub, $model) : $stub; } /** * Replace the model for the given stub. * * @param string $stub * @param string $model * @return string */ protected function replaceModel($stub, $model) { $modelClass = $this->parseModel($model); $replace = [ 'DummyFullModelClass' => $modelClass, '{{ namespacedModel }}' => $modelClass, '{{namespacedModel}}' => $modelClass, 'DummyModelClass' => class_basename($modelClass), '{{ model }}' => class_basename($modelClass), '{{model}}' => class_basename($modelClass), 'DummyModelVariable' => lcfirst(class_basename($modelClass)), '{{ modelVariable }}' => lcfirst(class_basename($modelClass)), '{{modelVariable}}' => lcfirst(class_basename($modelClass)), ]; return str_replace( array_keys($replace), array_values($replace), $stub ); } /** * Get the fully-qualified model class name. * * @param string $model * @return string * * @throws \InvalidArgumentException */ protected function parseModel($model) { if (preg_match('([^A-Za-z0-9_/\\\\])', $model)) { throw new InvalidArgumentException('Model name contains invalid characters.'); } return $this->qualifyModel($model); } /** * Get the stub file for the generator. * * @return string */ protected function getStub() { return $this->option('model') ? $this->resolveStubPath('/stubs/observer.stub') : $this->resolveStubPath('/stubs/observer.plain.stub'); } /** * Resolve the fully-qualified path to the stub. * * @param string $stub * @return string */ protected function resolveStubPath($stub) { return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) ? $customPath : __DIR__.$stub; } /** * Get the default namespace for the class. * * @param string $rootNamespace * @return string */ protected function getDefaultNamespace($rootNamespace) { return $rootNamespace.'\Observers'; } /** * Get the console command arguments. * * @return array */ protected function getOptions() { return [ ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the observer already exists'], ['model', 'm', InputOption::VALUE_OPTIONAL, 'The model that the observer applies to'], ]; } /** * Interact further with the user if they were prompted for missing arguments. * * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * @return void */ protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output) { if ($this->isReservedName($this->getNameInput()) || $this->didReceiveOptions($input)) { return; } $model = suggest( 'What model should this observer apply to? (Optional)', $this->possibleModels(), ); if ($model) { $input->setOption('model', $model); } } } PKO$W]]É`^è è 7src/Illuminate/Foundation/Console/RouteCacheCommand.phpnu„[µü¤files = $files; } /** * Execute the console command. * * @return void */ public function handle() { $this->callSilent('route:clear'); $routes = $this->getFreshApplicationRoutes(); if (count($routes) === 0) { return $this->components->error("Your application doesn't have any routes."); } foreach ($routes as $route) { $route->prepareForSerialization(); } $this->files->put( $this->laravel->getCachedRoutesPath(), $this->buildRouteCacheFile($routes) ); $this->components->info('Routes cached successfully.'); } /** * Boot a fresh copy of the application and get the routes. * * @return \Illuminate\Routing\RouteCollection */ protected function getFreshApplicationRoutes() { return tap($this->getFreshApplication()['router']->getRoutes(), function ($routes) { $routes->refreshNameLookups(); $routes->refreshActionLookups(); }); } /** * Get a fresh application instance. * * @return \Illuminate\Contracts\Foundation\Application */ protected function getFreshApplication() { return tap(require $this->laravel->bootstrapPath('app.php'), function ($app) { $app->make(ConsoleKernelContract::class)->bootstrap(); }); } /** * Build the route cache file. * * @param \Illuminate\Routing\RouteCollection $routes * @return string */ protected function buildRouteCacheFile(RouteCollection $routes) { $stub = $this->files->get(__DIR__.'/stubs/routes.stub'); return str_replace('{{routes}}', var_export($routes->compile(), true), $stub); } } PKO$W]ƒñÉF5src/Illuminate/Foundation/Console/RuleMakeCommand.phpnu„[µü¤option('implicit') ? 'ImplicitRule' : 'Rule', parent::buildClass($name) ); } /** * Get the stub file for the generator. * * @return string */ protected function getStub() { $stub = $this->option('implicit') ? '/stubs/rule.implicit.stub' : '/stubs/rule.stub'; return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) ? $customPath : __DIR__.$stub; } /** * Get the default namespace for the class. * * @param string $rootNamespace * @return string */ protected function getDefaultNamespace($rootNamespace) { return $rootNamespace.'\Rules'; } /** * Get the console command options. * * @return array */ protected function getOptions() { return [ ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the rule already exists'], ['implicit', 'i', InputOption::VALUE_NONE, 'Generate an implicit rule'], ]; } } PKO$W](�ͬvv6src/Illuminate/Foundation/Console/EventListCommand.phpnu„[µü¤getEvents()->sortKeys(); if ($events->isEmpty()) { $this->components->info("Your application doesn't have any events matching the given criteria."); return; } $this->newLine(); $events->each(function ($listeners, $event) { $this->components->twoColumnDetail($this->appendEventInterfaces($event)); $this->components->bulletList($listeners); }); $this->newLine(); } /** * Get all of the events and listeners configured for the application. * * @return \Illuminate\Support\Collection */ protected function getEvents() { $events = collect($this->getListenersOnDispatcher()); if ($this->filteringByEvent()) { $events = $this->filterEvents($events); } return $events; } /** * Get the event / listeners from the dispatcher object. * * @return array */ protected function getListenersOnDispatcher() { $events = []; foreach ($this->getRawListeners() as $event => $rawListeners) { foreach ($rawListeners as $rawListener) { if (is_string($rawListener)) { $events[$event][] = $this->appendListenerInterfaces($rawListener); } elseif ($rawListener instanceof Closure) { $events[$event][] = $this->stringifyClosure($rawListener); } elseif (is_array($rawListener) && count($rawListener) === 2) { if (is_object($rawListener[0])) { $rawListener[0] = get_class($rawListener[0]); } $events[$event][] = $this->appendListenerInterfaces(implode('@', $rawListener)); } } } return $events; } /** * Add the event implemented interfaces to the output. * * @param string $event * @return string */ protected function appendEventInterfaces($event) { if (! class_exists($event)) { return $event; } $interfaces = class_implements($event); if (in_array(ShouldBroadcast::class, $interfaces)) { $event .= ' (ShouldBroadcast)'; } return $event; } /** * Add the listener implemented interfaces to the output. * * @param string $listener * @return string */ protected function appendListenerInterfaces($listener) { $listener = explode('@', $listener); $interfaces = class_implements($listener[0]); $listener = implode('@', $listener); if (in_array(ShouldQueue::class, $interfaces)) { $listener .= ' (ShouldQueue)'; } return $listener; } /** * Get a displayable string representation of a Closure listener. * * @param \Closure $rawListener * @return string */ protected function stringifyClosure(Closure $rawListener) { $reflection = new ReflectionFunction($rawListener); $path = str_replace([base_path(), DIRECTORY_SEPARATOR], ['', '/'], $reflection->getFileName() ?: ''); return 'Closure at: '.$path.':'.$reflection->getStartLine(); } /** * Filter the given events using the provided event name filter. * * @param \Illuminate\Support\Collection $events * @return \Illuminate\Support\Collection */ protected function filterEvents($events) { if (! $eventName = $this->option('event')) { return $events; } return $events->filter( fn ($listeners, $event) => str_contains($event, $eventName) ); } /** * Determine whether the user is filtering by an event name. * * @return bool */ protected function filteringByEvent() { return ! empty($this->option('event')); } /** * Gets the raw version of event listeners from the event dispatcher. * * @return array */ protected function getRawListeners() { return $this->getEventsDispatcher()->getRawListeners(); } /** * Get the event dispatcher. * * @return \Illuminate\Events\Dispatcher */ public function getEventsDispatcher() { return is_null(self::$eventsResolver) ? $this->getLaravel()->make('events') : call_user_func(self::$eventsResolver); } /** * Set a callback that should be used when resolving the events dispatcher. * * @param \Closure|null $resolver * @return void */ public static function resolveEventsUsing($resolver) { static::$eventsResolver = $resolver; } } PKO$W]]Õ_¦" " 6src/Illuminate/Foundation/Console/ViewCacheCommand.phpnu„[µü¤callSilent('view:clear'); $this->paths()->each(function ($path) { $prefix = $this->output->isVeryVerbose() ? 'DIR ' : ''; $this->components->task($prefix.$path, null, OutputInterface::VERBOSITY_VERBOSE); $this->compileViews($this->bladeFilesIn([$path])); }); $this->newLine(); $this->components->info('Blade templates cached successfully.'); } /** * Compile the given view files. * * @param \Illuminate\Support\Collection $views * @return void */ protected function compileViews(Collection $views) { $compiler = $this->laravel['view']->getEngineResolver()->resolve('blade')->getCompiler(); $views->map(function (SplFileInfo $file) use ($compiler) { $this->components->task(' '.$file->getRelativePathname(), null, OutputInterface::VERBOSITY_VERY_VERBOSE); $compiler->compile($file->getRealPath()); }); if ($this->output->isVeryVerbose()) { $this->newLine(); } } /** * Get the Blade files in the given path. * * @param array $paths * @return \Illuminate\Support\Collection */ protected function bladeFilesIn(array $paths) { $extensions = collect($this->laravel['view']->getExtensions()) ->filter(fn ($value) => $value === 'blade') ->keys() ->map(fn ($extension) => "*.{$extension}") ->all(); return collect( Finder::create() ->in($paths) ->exclude('vendor') ->name($extensions) ->files() ); } /** * Get all of the possible view paths. * * @return \Illuminate\Support\Collection */ protected function paths() { $finder = $this->laravel['view']->getFinder(); return collect($finder->getPaths())->merge( collect($finder->getHints())->flatten() ); } } PKO$W]˜‘úó'ó'2src/Illuminate/Foundation/Console/ServeCommand.phpnu„[µü¤ */ protected $requestsPool; /** * Indicates if the "Server running on..." output message has been displayed. * * @var bool */ protected $serverRunningHasBeenDisplayed = false; /** * The environment variables that should be passed from host machine to the PHP server process. * * @var string[] */ public static $passthroughVariables = [ 'APP_ENV', 'HERD_PHP_81_INI_SCAN_DIR', 'HERD_PHP_82_INI_SCAN_DIR', 'HERD_PHP_83_INI_SCAN_DIR', 'IGNITION_LOCAL_SITES_PATH', 'LARAVEL_SAIL', 'PATH', 'PHP_CLI_SERVER_WORKERS', 'PHP_IDE_CONFIG', 'SYSTEMROOT', 'XDEBUG_CONFIG', 'XDEBUG_MODE', 'XDEBUG_SESSION', ]; /** * Execute the console command. * * @return int * * @throws \Exception */ public function handle() { $environmentFile = $this->option('env') ? base_path('.env').'.'.$this->option('env') : base_path('.env'); $hasEnvironment = file_exists($environmentFile); $environmentLastModified = $hasEnvironment ? filemtime($environmentFile) : now()->addDays(30)->getTimestamp(); $process = $this->startProcess($hasEnvironment); while ($process->isRunning()) { if ($hasEnvironment) { clearstatcache(false, $environmentFile); } if (! $this->option('no-reload') && $hasEnvironment && filemtime($environmentFile) > $environmentLastModified) { $environmentLastModified = filemtime($environmentFile); $this->newLine(); $this->components->info('Environment modified. Restarting server...'); $process->stop(5); $this->serverRunningHasBeenDisplayed = false; $process = $this->startProcess($hasEnvironment); } usleep(500 * 1000); } $status = $process->getExitCode(); if ($status && $this->canTryAnotherPort()) { $this->portOffset += 1; return $this->handle(); } return $status; } /** * Start a new server process. * * @param bool $hasEnvironment * @return \Symfony\Component\Process\Process */ protected function startProcess($hasEnvironment) { $process = new Process($this->serverCommand(), public_path(), collect($_ENV)->mapWithKeys(function ($value, $key) use ($hasEnvironment) { if ($this->option('no-reload') || ! $hasEnvironment) { return [$key => $value]; } return in_array($key, static::$passthroughVariables) ? [$key => $value] : [$key => false]; })->all()); $this->trap(fn () => [SIGTERM, SIGINT, SIGHUP, SIGUSR1, SIGUSR2, SIGQUIT], function ($signal) use ($process) { if ($process->isRunning()) { $process->stop(10, $signal); } exit; }); $process->start($this->handleProcessOutput()); return $process; } /** * Get the full server command. * * @return array */ protected function serverCommand() { $server = file_exists(base_path('server.php')) ? base_path('server.php') : __DIR__.'/../resources/server.php'; return [ (new PhpExecutableFinder)->find(false), '-S', $this->host().':'.$this->port(), $server, ]; } /** * Get the host for the command. * * @return string */ protected function host() { [$host] = $this->getHostAndPort(); return $host; } /** * Get the port for the command. * * @return string */ protected function port() { $port = $this->input->getOption('port'); if (is_null($port)) { [, $port] = $this->getHostAndPort(); } $port = $port ?: 8000; return $port + $this->portOffset; } /** * Get the host and port from the host option string. * * @return array */ protected function getHostAndPort() { if (preg_match('/(\[.*\]):?([0-9]+)?/', $this->input->getOption('host'), $matches) !== false) { return [ $matches[1] ?? $this->input->getOption('host'), $matches[2] ?? null, ]; } $hostParts = explode(':', $this->input->getOption('host')); return [ $hostParts[0], $hostParts[1] ?? null, ]; } /** * Check if the command has reached its maximum number of port tries. * * @return bool */ protected function canTryAnotherPort() { return is_null($this->input->getOption('port')) && ($this->input->getOption('tries') > $this->portOffset); } /** * Returns a "callable" to handle the process output. * * @return callable(string, string): void */ protected function handleProcessOutput() { return fn ($type, $buffer) => str($buffer)->explode("\n")->each(function ($line) { if (str($line)->contains('Development Server (http')) { if ($this->serverRunningHasBeenDisplayed) { return; } $this->components->info("Server running on [http://{$this->host()}:{$this->port()}]."); $this->comment(' Press Ctrl+C to stop the server'); $this->newLine(); $this->serverRunningHasBeenDisplayed = true; } elseif (str($line)->contains(' Accepted')) { $requestPort = $this->getRequestPortFromLine($line); $this->requestsPool[$requestPort] = [ $this->getDateFromLine($line), false, ]; } elseif (str($line)->contains([' [200]: GET '])) { $requestPort = $this->getRequestPortFromLine($line); $this->requestsPool[$requestPort][1] = trim(explode('[200]: GET', $line)[1]); } elseif (str($line)->contains(' Closing')) { $requestPort = $this->getRequestPortFromLine($line); if (empty($this->requestsPool[$requestPort])) { return; } [$startDate, $file] = $this->requestsPool[$requestPort]; $formattedStartedAt = $startDate->format('Y-m-d H:i:s'); unset($this->requestsPool[$requestPort]); [$date, $time] = explode(' ', $formattedStartedAt); $this->output->write(" $date $time"); $runTime = $this->getDateFromLine($line)->diffInSeconds($startDate); if ($file) { $this->output->write($file = " $file"); } $dots = max(terminal()->width() - mb_strlen($formattedStartedAt) - mb_strlen($file) - mb_strlen($runTime) - 9, 0); $this->output->write(' '.str_repeat('.', $dots)); $this->output->writeln(" ~ {$runTime}s"); } elseif (str($line)->contains(['Closed without sending a request', 'Failed to poll event'])) { // ... } elseif (! empty($line)) { $position = strpos($line, '] '); if ($position !== false) { $line = substr($line, $position + 1); } $this->components->warn($line); } }); } /** * Get the date from the given PHP server output. * * @param string $line * @return \Illuminate\Support\Carbon */ protected function getDateFromLine($line) { $regex = env('PHP_CLI_SERVER_WORKERS', 1) > 1 ? '/^\[\d+]\s\[([a-zA-Z0-9: ]+)\]/' : '/^\[([^\]]+)\]/'; $line = str_replace(' ', ' ', $line); preg_match($regex, $line, $matches); return Carbon::createFromFormat('D M d H:i:s Y', $matches[1]); } /** * Get the request port from the given PHP server output. * * @param string $line * @return int */ protected function getRequestPortFromLine($line) { preg_match('/:(\d+)\s(?:(?:\w+$)|(?:\[.*))/', $line, $matches); return (int) $matches[1]; } /** * Get the console command options. * * @return array */ protected function getOptions() { return [ ['host', null, InputOption::VALUE_OPTIONAL, 'The host address to serve the application on', Env::get('SERVER_HOST', '127.0.0.1')], ['port', null, InputOption::VALUE_OPTIONAL, 'The port to serve the application on', Env::get('SERVER_PORT')], ['tries', null, InputOption::VALUE_OPTIONAL, 'The max number of ports to attempt to serve from', 10], ['no-reload', null, InputOption::VALUE_NONE, 'Do not reload the development server on .env file changes'], ]; } } PKO$W]ÊÛhªª8src/Illuminate/Foundation/Console/ChannelMakeCommand.phpnu„[µü¤userProviderModel()), parent::buildClass($name) ); } /** * Get the stub file for the generator. * * @return string */ protected function getStub() { return __DIR__.'/stubs/channel.stub'; } /** * Get the default namespace for the class. * * @param string $rootNamespace * @return string */ protected function getDefaultNamespace($rootNamespace) { return $rootNamespace.'\Broadcasting'; } /** * Get the console command arguments. * * @return array */ protected function getOptions() { return [ ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the channel already exists'], ]; } } PKO$W]raóÙ§§/src/Illuminate/Foundation/Console/UpCommand.phpnu„[µü¤laravel->maintenanceMode()->active()) { $this->components->info('Application is already up.'); return 0; } $this->laravel->maintenanceMode()->deactivate(); if (is_file(storage_path('framework/maintenance.php'))) { unlink(storage_path('framework/maintenance.php')); } $this->laravel->get('events')->dispatch(new MaintenanceModeDisabled()); $this->components->info('Application is now live.'); } catch (Exception $e) { $this->components->error(sprintf( 'Failed to disable maintenance mode: %s.', $e->getMessage(), )); return 1; } return 0; } } PKO$W]Wú³<´´:src/Illuminate/Foundation/Console/ClearCompiledCommand.phpnu„[µü¤laravel->getCachedServicesPath())) { @unlink($servicesPath); } if (is_file($packagesPath = $this->laravel->getCachedPackagesPath())) { @unlink($packagesPath); } $this->components->info('Compiled services and packages files removed successfully.'); } } PKO$W]–³n°°5src/Illuminate/Foundation/Console/OptimizeCommand.phpnu„[µü¤components->info('Caching the framework bootstrap files'); collect([ 'config' => fn () => $this->callSilent('config:cache') == 0, 'routes' => fn () => $this->callSilent('route:cache') == 0, ])->each(fn ($task, $description) => $this->components->task($description, $task)); $this->newLine(); } } PKO$W]^*”ÒË Ë ?src/Illuminate/Foundation/Console/EnvironmentEncryptCommand.phpnu„[µü¤files = $files; } /** * Execute the console command. * * @return void */ public function handle() { $cipher = $this->option('cipher') ?: 'AES-256-CBC'; $key = $this->option('key'); $keyPassed = $key !== null; $environmentFile = $this->option('env') ? base_path('.env').'.'.$this->option('env') : $this->laravel->environmentFilePath(); $encryptedFile = $environmentFile.'.encrypted'; if (! $keyPassed) { $key = Encrypter::generateKey($cipher); } if (! $this->files->exists($environmentFile)) { $this->components->error('Environment file not found.'); return Command::FAILURE; } if ($this->files->exists($encryptedFile) && ! $this->option('force')) { $this->components->error('Encrypted environment file already exists.'); return Command::FAILURE; } try { $encrypter = new Encrypter($this->parseKey($key), $cipher); $this->files->put( $encryptedFile, $encrypter->encrypt($this->files->get($environmentFile)) ); } catch (Exception $e) { $this->components->error($e->getMessage()); return Command::FAILURE; } $this->components->info('Environment successfully encrypted.'); $this->components->twoColumnDetail('Key', $keyPassed ? $key : 'base64:'.base64_encode($key)); $this->components->twoColumnDetail('Cipher', $cipher); $this->components->twoColumnDetail('Encrypted file', $encryptedFile); $this->newLine(); } /** * Parse the encryption key. * * @param string $key * @return string */ protected function parseKey(string $key) { if (Str::startsWith($key, $prefix = 'base64:')) { $key = base64_decode(Str::after($key, $prefix)); } return $key; } } PKO$W]¿YÙgg5src/Illuminate/Foundation/Console/CastMakeCommand.phpnu„[µü¤option('inbound') ? $this->resolveStubPath('/stubs/cast.inbound.stub') : $this->resolveStubPath('/stubs/cast.stub'); } /** * Resolve the fully-qualified path to the stub. * * @param string $stub * @return string */ protected function resolveStubPath($stub) { return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) ? $customPath : __DIR__.$stub; } /** * Get the default namespace for the class. * * @param string $rootNamespace * @return string */ protected function getDefaultNamespace($rootNamespace) { return $rootNamespace.'\Casts'; } /** * Get the console command arguments. * * @return array */ protected function getOptions() { return [ ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the cast already exists'], ['inbound', null, InputOption::VALUE_NONE, 'Generate an inbound cast class'], ]; } } PKO$W]5•�78src/Illuminate/Foundation/Console/ChannelListCommand.phpnu„[µü¤getChannels(); if (! $this->laravel->providerIsLoaded('App\Providers\BroadcastServiceProvider') && file_exists($this->laravel->path('Providers/BroadcastServiceProvider.php'))) { $this->components->warn('The [App\Providers\BroadcastServiceProvider] has not been loaded. Your private channels may not be loaded.'); } if (! $channels->count()) { return $this->components->error("Your application doesn't have any private broadcasting channels."); } $this->displayChannels($channels); } /** * Display the channel information on the console. * * @param Collection $channels * @return void */ protected function displayChannels($channels) { $this->output->writeln($this->forCli($channels)); } /** * Convert the given channels to regular CLI output. * * @param \Illuminate\Support\Collection $channels * @return array */ protected function forCli($channels) { $maxChannelName = $channels->keys()->max(function ($channelName) { return mb_strlen($channelName); }); $terminalWidth = $this->getTerminalWidth(); $channelCount = $this->determineChannelCountOutput($channels, $terminalWidth); return $channels->map(function ($channel, $channelName) use ($maxChannelName, $terminalWidth) { $resolver = $channel instanceof Closure ? 'Closure' : $channel; $spaces = str_repeat(' ', max($maxChannelName + 6 - mb_strlen($channelName), 0)); $dots = str_repeat('.', max( $terminalWidth - mb_strlen($channelName.$spaces.$resolver) - 6, 0 )); $dots = empty($dots) ? $dots : " $dots"; return sprintf( ' %s %s%s%s', $channelName, $spaces, $resolver, $dots, ); }) ->filter() ->sort() ->prepend('') ->push('')->push($channelCount)->push('') ->toArray(); } /** * Determine and return the output for displaying the number of registered channels in the CLI output. * * @param \Illuminate\Support\Collection $channels * @param int $terminalWidth * @return string */ protected function determineChannelCountOutput($channels, $terminalWidth) { $channelCountText = 'Showing ['.$channels->count().'] private channels'; $offset = $terminalWidth - mb_strlen($channelCountText) - 2; $spaces = str_repeat(' ', $offset); return $spaces.'Showing ['.$channels->count().'] private channels'; } /** * Get the terminal width. * * @return int */ public static function getTerminalWidth() { return is_null(static::$terminalWidthResolver) ? (new Terminal)->getWidth() : call_user_func(static::$terminalWidthResolver); } /** * Set a callback that should be used when resolving the terminal width. * * @param \Closure|null $resolver * @return void */ public static function resolveTerminalWidthUsing($resolver) { static::$terminalWidthResolver = $resolver; } } PKO$W]ÖË Nww8src/Illuminate/Foundation/Console/ConfigCacheCommand.phpnu„[µü¤files = $files; } /** * Execute the console command. * * @return void * * @throws \LogicException */ public function handle() { $this->callSilent('config:clear'); $config = $this->getFreshConfiguration(); $configPath = $this->laravel->getCachedConfigPath(); $this->files->put( $configPath, 'files->delete($configPath); throw new LogicException('Your configuration files are not serializable.', 0, $e); } $this->components->info('Configuration cached successfully.'); } /** * Boot a fresh copy of the application configuration. * * @return array */ protected function getFreshConfiguration() { $app = require $this->laravel->bootstrapPath('app.php'); $app->useStoragePath($this->laravel->storagePath()); $app->make(ConsoleKernelContract::class)->bootstrap(); return $app['config']->all(); } } PKO$W] •½Ð Ð 8src/Illuminate/Foundation/Console/ConsoleMakeCommand.phpnu„[µü¤option('command') ?: 'app:'.Str::of($name)->classBasename()->kebab()->value(); return str_replace(['dummy:command', '{{ command }}'], $command, $stub); } /** * Get the stub file for the generator. * * @return string */ protected function getStub() { $relativePath = '/stubs/console.stub'; return file_exists($customPath = $this->laravel->basePath(trim($relativePath, '/'))) ? $customPath : __DIR__.$relativePath; } /** * Get the default namespace for the class. * * @param string $rootNamespace * @return string */ protected function getDefaultNamespace($rootNamespace) { return $rootNamespace.'\Console\Commands'; } /** * Get the console command arguments. * * @return array */ protected function getArguments() { return [ ['name', InputArgument::REQUIRED, 'The name of the command'], ]; } /** * Get the console command options. * * @return array */ protected function getOptions() { return [ ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the console command already exists'], ['command', null, InputOption::VALUE_OPTIONAL, 'The terminal command that will be used to invoke the class'], ]; } } PKO$W]ÖaùKK8src/Illuminate/Foundation/Console/LangPublishCommand.phpnu„[µü¤laravel->basePath('lang/en'))) { (new Filesystem)->makeDirectory($langPath, recursive: true); } $stubs = [ realpath(__DIR__.'/../../Translation/lang/en/auth.php') => 'auth.php', realpath(__DIR__.'/../../Translation/lang/en/pagination.php') => 'pagination.php', realpath(__DIR__.'/../../Translation/lang/en/passwords.php') => 'passwords.php', realpath(__DIR__.'/../../Translation/lang/en/validation.php') => 'validation.php', ]; foreach ($stubs as $from => $to) { $to = $langPath.DIRECTORY_SEPARATOR.ltrim($to, DIRECTORY_SEPARATOR); if ((! $this->option('existing') && (! file_exists($to) || $this->option('force'))) || ($this->option('existing') && file_exists($to))) { file_put_contents($to, file_get_contents($from)); } } $this->components->info('Language files published successfully.'); } } PKO$W]8}œÖÖ8src/Illuminate/Foundation/Console/EnvironmentCommand.phpnu„[µü¤components->info(sprintf( 'The application environment is [%s].', $this->laravel['env'], )); } } PKO$W]ûºï•ÊÊ.src/Illuminate/Foundation/resources/server.phpnu„[µü¤src/Illuminate/Foundation/Http/MaintenanceModeBypassCookie.phpnu„[µü¤addHours(12); return new Cookie('laravel_maintenance', base64_encode(json_encode([ 'expires_at' => $expiresAt->getTimestamp(), 'mac' => hash_hmac('sha256', $expiresAt->getTimestamp(), $key), ])), $expiresAt, config('session.path'), config('session.domain')); } /** * Determine if the given maintenance mode bypass cookie is valid. * * @param string $cookie * @param string $key * @return bool */ public static function isValid(string $cookie, string $key) { $payload = json_decode(base64_decode($cookie), true); return is_array($payload) && is_numeric($payload['expires_at'] ?? null) && isset($payload['mac']) && hash_equals(hash_hmac('sha256', $payload['expires_at'], $key), $payload['mac']) && (int) $payload['expires_at'] >= Carbon::now()->getTimestamp(); } } PKO$W]¯žéšÏÏ.src/Illuminate/Foundation/Http/FormRequest.phpnu„[µü¤validator) { return $this->validator; } $factory = $this->container->make(ValidationFactory::class); if (method_exists($this, 'validator')) { $validator = $this->container->call([$this, 'validator'], compact('factory')); } else { $validator = $this->createDefaultValidator($factory); } if (method_exists($this, 'withValidator')) { $this->withValidator($validator); } if (method_exists($this, 'after')) { $validator->after($this->container->call( $this->after(...), ['validator' => $validator] )); } $this->setValidator($validator); return $this->validator; } /** * Create the default validator instance. * * @param \Illuminate\Contracts\Validation\Factory $factory * @return \Illuminate\Contracts\Validation\Validator */ protected function createDefaultValidator(ValidationFactory $factory) { $rules = $this->validationRules(); $validator = $factory->make( $this->validationData(), $rules, $this->messages(), $this->attributes(), )->stopOnFirstFailure($this->stopOnFirstFailure); if ($this->isPrecognitive()) { $validator->setRules( $this->filterPrecognitiveRules($validator->getRulesWithoutPlaceholders()) ); } return $validator; } /** * Get data to be validated from the request. * * @return array */ public function validationData() { return $this->all(); } /** * Get the validation rules for this form request. * * @return array */ protected function validationRules() { return method_exists($this, 'rules') ? $this->container->call([$this, 'rules']) : []; } /** * Handle a failed validation attempt. * * @param \Illuminate\Contracts\Validation\Validator $validator * @return void * * @throws \Illuminate\Validation\ValidationException */ protected function failedValidation(Validator $validator) { $exception = $validator->getException(); throw (new $exception($validator)) ->errorBag($this->errorBag) ->redirectTo($this->getRedirectUrl()); } /** * Get the URL to redirect to on a validation error. * * @return string */ protected function getRedirectUrl() { $url = $this->redirector->getUrlGenerator(); if ($this->redirect) { return $url->to($this->redirect); } elseif ($this->redirectRoute) { return $url->route($this->redirectRoute); } elseif ($this->redirectAction) { return $url->action($this->redirectAction); } return $url->previous(); } /** * Determine if the request passes the authorization check. * * @return bool * * @throws \Illuminate\Auth\Access\AuthorizationException */ protected function passesAuthorization() { if (method_exists($this, 'authorize')) { $result = $this->container->call([$this, 'authorize']); return $result instanceof Response ? $result->authorize() : $result; } return true; } /** * Handle a failed authorization attempt. * * @return void * * @throws \Illuminate\Auth\Access\AuthorizationException */ protected function failedAuthorization() { throw new AuthorizationException; } /** * Get a validated input container for the validated input. * * @param array|null $keys * @return \Illuminate\Support\ValidatedInput|array */ public function safe(?array $keys = null) { return is_array($keys) ? $this->validator->safe()->only($keys) : $this->validator->safe(); } /** * Get the validated data from the request. * * @param array|int|string|null $key * @param mixed $default * @return mixed */ public function validated($key = null, $default = null) { return data_get($this->validator->validated(), $key, $default); } /** * Get custom messages for validator errors. * * @return array */ public function messages() { return []; } /** * Get custom attributes for validator errors. * * @return array */ public function attributes() { return []; } /** * Set the Validator instance. * * @param \Illuminate\Contracts\Validation\Validator $validator * @return $this */ public function setValidator(Validator $validator) { $this->validator = $validator; return $this; } /** * Set the Redirector instance. * * @param \Illuminate\Routing\Redirector $redirector * @return $this */ public function setRedirector(Redirector $redirector) { $this->redirector = $redirector; return $this; } /** * Set the container implementation. * * @param \Illuminate\Contracts\Container\Container $container * @return $this */ public function setContainer(Container $container) { $this->container = $container; return $this; } } PKO$W]ÀeÇm––9src/Illuminate/Foundation/Http/Middleware/TrimStrings.phpnu„[µü¤ */ protected $except = [ // ]; /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { foreach (static::$skipCallbacks as $callback) { if ($callback($request)) { return $next($request); } } return parent::handle($request, $next); } /** * Transform the given value. * * @param string $key * @param mixed $value * @return mixed */ protected function transform($key, $value) { if (in_array($key, $this->except, true) || ! is_string($value)) { return $value; } return preg_replace('~^[\s\x{FEFF}\x{200B}]+|[\s\x{FEFF}\x{200B}]+$~u', '', $value) ?? trim($value); } /** * Register a callback that instructs the middleware to be skipped. * * @param \Closure $callback * @return void */ public static function skipWhen(Closure $callback) { static::$skipCallbacks[] = $callback; } /** * Flush the middleware's global state. * * @return void */ public static function flushState() { static::$skipCallbacks = []; } } PKO$W]�šx¥00?src/Illuminate/Foundation/Http/Middleware/TransformsRequest.phpnu„[µü¤clean($request); return $next($request); } /** * Clean the request's data. * * @param \Illuminate\Http\Request $request * @return void */ protected function clean($request) { $this->cleanParameterBag($request->query); if ($request->isJson()) { $this->cleanParameterBag($request->json()); } elseif ($request->request !== $request->query) { $this->cleanParameterBag($request->request); } } /** * Clean the data in the parameter bag. * * @param \Symfony\Component\HttpFoundation\ParameterBag $bag * @return void */ protected function cleanParameterBag(ParameterBag $bag) { $bag->replace($this->cleanArray($bag->all())); } /** * Clean the data in the given array. * * @param array $data * @param string $keyPrefix * @return array */ protected function cleanArray(array $data, $keyPrefix = '') { foreach ($data as $key => $value) { $data[$key] = $this->cleanValue($keyPrefix.$key, $value); } return $data; } /** * Clean the given value. * * @param string $key * @param mixed $value * @return mixed */ protected function cleanValue($key, $value) { if (is_array($value)) { return $this->cleanArray($value, $key.'.'); } return $this->transform($key, $value); } /** * Transform the given value. * * @param string $key * @param mixed $value * @return mixed */ protected function transform($key, $value) { return $value; } } PKO$W]MvJÆÆ>src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.phpnu„[µü¤getPostMaxSize(); if ($max > 0 && $request->server('CONTENT_LENGTH') > $max) { throw new PostTooLargeException; } return $next($request); } /** * Determine the server 'post_max_size' as bytes. * * @return int */ protected function getPostMaxSize() { if (is_numeric($postMaxSize = ini_get('post_max_size'))) { return (int) $postMaxSize; } $metric = strtoupper(substr($postMaxSize, -1)); $postMaxSize = (int) $postMaxSize; return match ($metric) { 'K' => $postMaxSize * 1024, 'M' => $postMaxSize * 1048576, 'G' => $postMaxSize * 1073741824, default => $postMaxSize, }; } } PKO$W]Óå#³½½Nsrc/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.phpnu„[µü¤ */ protected $except = []; /** * Create a new middleware instance. * * @param \Illuminate\Contracts\Foundation\Application $app * @return void */ public function __construct(Application $app) { $this->app = $app; } /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed * * @throws \Symfony\Component\HttpKernel\Exception\HttpException * @throws \ErrorException */ public function handle($request, Closure $next) { if ($this->inExceptArray($request)) { return $next($request); } if ($this->app->maintenanceMode()->active()) { try { $data = $this->app->maintenanceMode()->data(); } catch (ErrorException $exception) { if (! $this->app->maintenanceMode()->active()) { return $next($request); } throw $exception; } if (isset($data['secret']) && $request->path() === $data['secret']) { return $this->bypassResponse($data['secret']); } if ($this->hasValidBypassCookie($request, $data)) { return $next($request); } if (isset($data['redirect'])) { $path = $data['redirect'] === '/' ? $data['redirect'] : trim($data['redirect'], '/'); if ($request->path() !== $path) { return redirect($path); } } if (isset($data['template'])) { return response( $data['template'], $data['status'] ?? 503, $this->getHeaders($data) ); } throw new HttpException( $data['status'] ?? 503, 'Service Unavailable', null, $this->getHeaders($data) ); } return $next($request); } /** * Determine if the incoming request has a maintenance mode bypass cookie. * * @param \Illuminate\Http\Request $request * @param array $data * @return bool */ protected function hasValidBypassCookie($request, array $data) { return isset($data['secret']) && $request->cookie('laravel_maintenance') && MaintenanceModeBypassCookie::isValid( $request->cookie('laravel_maintenance'), $data['secret'] ); } /** * Determine if the request has a URI that should be accessible in maintenance mode. * * @param \Illuminate\Http\Request $request * @return bool */ protected function inExceptArray($request) { foreach ($this->getExcludedPaths() as $except) { if ($except !== '/') { $except = trim($except, '/'); } if ($request->fullUrlIs($except) || $request->is($except)) { return true; } } return false; } /** * Redirect the user back to the root of the application with a maintenance mode bypass cookie. * * @param string $secret * @return \Illuminate\Http\RedirectResponse */ protected function bypassResponse(string $secret) { return redirect('/')->withCookie( MaintenanceModeBypassCookie::create($secret) ); } /** * Get the headers that should be sent with the response. * * @param array $data * @return array */ protected function getHeaders($data) { $headers = isset($data['retry']) ? ['Retry-After' => $data['retry']] : []; if (isset($data['refresh'])) { $headers['Refresh'] = $data['refresh']; } return $headers; } /** * Get the URIs that should be accessible even when maintenance mode is enabled. * * @return array */ public function getExcludedPaths() { return $this->except; } } PKO$W]@;A‘ ‘ Hsrc/Illuminate/Foundation/Http/Middleware/HandlePrecognitiveRequests.phpnu„[µü¤container = $container; } /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return \Illuminate\Http\Response */ public function handle($request, $next) { if (! $request->isAttemptingPrecognition()) { return $this->appendVaryHeader($request, $next($request)); } $this->prepareForPrecognition($request); return tap($next($request), function ($response) use ($request) { $response->headers->set('Precognition', 'true'); $this->appendVaryHeader($request, $response); }); } /** * Prepare to handle a precognitive request. * * @param \Illuminate\Http\Request $request * @return void */ protected function prepareForPrecognition($request) { $request->attributes->set('precognitive', true); $this->container->bind(CallableDispatcherContract::class, fn ($app) => new PrecognitionCallableDispatcher($app)); $this->container->bind(ControllerDispatcherContract::class, fn ($app) => new PrecognitionControllerDispatcher($app)); } /** * Append the appropriate "Vary" header to the given response. * * @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Response $response * @return \Illuminate\Http\Response */ protected function appendVaryHeader($request, $response) { return tap($response, fn () => $response->headers->set('Vary', implode(', ', array_filter([ $response->headers->get('Vary'), 'Precognition', ])))); } } PKO$W]ù®œº``Gsrc/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.phpnu„[µü¤ */ protected $except = []; /** * Indicates whether the XSRF-TOKEN cookie should be set on the response. * * @var bool */ protected $addHttpCookie = true; /** * Create a new middleware instance. * * @param \Illuminate\Contracts\Foundation\Application $app * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter * @return void */ public function __construct(Application $app, Encrypter $encrypter) { $this->app = $app; $this->encrypter = $encrypter; } /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed * * @throws \Illuminate\Session\TokenMismatchException */ public function handle($request, Closure $next) { if ( $this->isReading($request) || $this->runningUnitTests() || $this->inExceptArray($request) || $this->tokensMatch($request) ) { return tap($next($request), function ($response) use ($request) { if ($this->shouldAddXsrfTokenCookie()) { $this->addCookieToResponse($request, $response); } }); } throw new TokenMismatchException('CSRF token mismatch.'); } /** * Determine if the HTTP request uses a ‘read’ verb. * * @param \Illuminate\Http\Request $request * @return bool */ protected function isReading($request) { return in_array($request->method(), ['HEAD', 'GET', 'OPTIONS']); } /** * Determine if the application is running unit tests. * * @return bool */ protected function runningUnitTests() { return $this->app->runningInConsole() && $this->app->runningUnitTests(); } /** * Determine if the request has a URI that should pass through CSRF verification. * * @param \Illuminate\Http\Request $request * @return bool */ protected function inExceptArray($request) { foreach ($this->except as $except) { if ($except !== '/') { $except = trim($except, '/'); } if ($request->fullUrlIs($except) || $request->is($except)) { return true; } } return false; } /** * Determine if the session and input CSRF tokens match. * * @param \Illuminate\Http\Request $request * @return bool */ protected function tokensMatch($request) { $token = $this->getTokenFromRequest($request); return is_string($request->session()->token()) && is_string($token) && hash_equals($request->session()->token(), $token); } /** * Get the CSRF token from the request. * * @param \Illuminate\Http\Request $request * @return string|null */ protected function getTokenFromRequest($request) { $token = $request->input('_token') ?: $request->header('X-CSRF-TOKEN'); if (! $token && $header = $request->header('X-XSRF-TOKEN')) { try { $token = CookieValuePrefix::remove($this->encrypter->decrypt($header, static::serialized())); } catch (DecryptException) { $token = ''; } } return $token; } /** * Determine if the cookie should be added to the response. * * @return bool */ public function shouldAddXsrfTokenCookie() { return $this->addHttpCookie; } /** * Add the CSRF token to the response cookies. * * @param \Illuminate\Http\Request $request * @param \Symfony\Component\HttpFoundation\Response $response * @return \Symfony\Component\HttpFoundation\Response */ protected function addCookieToResponse($request, $response) { $config = config('session'); if ($response instanceof Responsable) { $response = $response->toResponse($request); } $response->headers->setCookie($this->newCookie($request, $config)); return $response; } /** * Create a new "XSRF-TOKEN" cookie that contains the CSRF token. * * @param \Illuminate\Http\Request $request * @param array $config * @return \Symfony\Component\HttpFoundation\Cookie */ protected function newCookie($request, $config) { return new Cookie( 'XSRF-TOKEN', $request->session()->token(), $this->availableAt(60 * $config['lifetime']), $config['path'], $config['domain'], $config['secure'], false, false, $config['same_site'] ?? null, $config['partitioned'] ?? false ); } /** * Determine if the cookie contents should be serialized. * * @return bool */ public static function serialized() { return EncryptCookies::serialized('XSRF-TOKEN'); } } PKO$W](H´‹‹Esrc/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.phpnu„[µü¤ */ protected $middleware = []; /** * The application's route middleware groups. * * @var array> */ protected $middlewareGroups = []; /** * The application's route middleware. * * @var array * * @deprecated */ protected $routeMiddleware = []; /** * The application's middleware aliases. * * @var array */ protected $middlewareAliases = []; /** * All of the registered request duration handlers. * * @var array */ protected $requestLifecycleDurationHandlers = []; /** * When the kernel starting handling the current request. * * @var \Illuminate\Support\Carbon|null */ protected $requestStartedAt; /** * The priority-sorted list of middleware. * * Forces non-global middleware to always be in the given order. * * @var string[] */ protected $middlewarePriority = [ \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class, \Illuminate\Cookie\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \Illuminate\Contracts\Auth\Middleware\AuthenticatesRequests::class, \Illuminate\Routing\Middleware\ThrottleRequests::class, \Illuminate\Routing\Middleware\ThrottleRequestsWithRedis::class, \Illuminate\Contracts\Session\Middleware\AuthenticatesSessions::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, \Illuminate\Auth\Middleware\Authorize::class, ]; /** * Create a new HTTP kernel instance. * * @param \Illuminate\Contracts\Foundation\Application $app * @param \Illuminate\Routing\Router $router * @return void */ public function __construct(Application $app, Router $router) { $this->app = $app; $this->router = $router; $this->syncMiddlewareToRouter(); } /** * Handle an incoming HTTP request. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function handle($request) { $this->requestStartedAt = Carbon::now(); try { $request->enableHttpMethodParameterOverride(); $response = $this->sendRequestThroughRouter($request); } catch (Throwable $e) { $this->reportException($e); $response = $this->renderException($request, $e); } $this->app['events']->dispatch( new RequestHandled($request, $response) ); return $response; } /** * Send the given request through the middleware / router. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ protected function sendRequestThroughRouter($request) { $this->app->instance('request', $request); Facade::clearResolvedInstance('request'); $this->bootstrap(); return (new Pipeline($this->app)) ->send($request) ->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware) ->then($this->dispatchToRouter()); } /** * Bootstrap the application for HTTP requests. * * @return void */ public function bootstrap() { if (! $this->app->hasBeenBootstrapped()) { $this->app->bootstrapWith($this->bootstrappers()); } } /** * Get the route dispatcher callback. * * @return \Closure */ protected function dispatchToRouter() { return function ($request) { $this->app->instance('request', $request); return $this->router->dispatch($request); }; } /** * Call the terminate method on any terminable middleware. * * @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Response $response * @return void */ public function terminate($request, $response) { $this->terminateMiddleware($request, $response); $this->app->terminate(); if ($this->requestStartedAt === null) { return; } $this->requestStartedAt->setTimezone($this->app['config']->get('app.timezone') ?? 'UTC'); foreach ($this->requestLifecycleDurationHandlers as ['threshold' => $threshold, 'handler' => $handler]) { $end ??= Carbon::now(); if ($this->requestStartedAt->diffInMilliseconds($end) > $threshold) { $handler($this->requestStartedAt, $request, $response); } } $this->requestStartedAt = null; } /** * Call the terminate method on any terminable middleware. * * @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Response $response * @return void */ protected function terminateMiddleware($request, $response) { $middlewares = $this->app->shouldSkipMiddleware() ? [] : array_merge( $this->gatherRouteMiddleware($request), $this->middleware ); foreach ($middlewares as $middleware) { if (! is_string($middleware)) { continue; } [$name] = $this->parseMiddleware($middleware); $instance = $this->app->make($name); if (method_exists($instance, 'terminate')) { $instance->terminate($request, $response); } } } /** * Register a callback to be invoked when the requests lifecycle duration exceeds a given amount of time. * * @param \DateTimeInterface|\Carbon\CarbonInterval|float|int $threshold * @param callable $handler * @return void */ public function whenRequestLifecycleIsLongerThan($threshold, $handler) { $threshold = $threshold instanceof DateTimeInterface ? $this->secondsUntil($threshold) * 1000 : $threshold; $threshold = $threshold instanceof CarbonInterval ? $threshold->totalMilliseconds : $threshold; $this->requestLifecycleDurationHandlers[] = [ 'threshold' => $threshold, 'handler' => $handler, ]; } /** * When the request being handled started. * * @return \Illuminate\Support\Carbon|null */ public function requestStartedAt() { return $this->requestStartedAt; } /** * Gather the route middleware for the given request. * * @param \Illuminate\Http\Request $request * @return array */ protected function gatherRouteMiddleware($request) { if ($route = $request->route()) { return $this->router->gatherRouteMiddleware($route); } return []; } /** * Parse a middleware string to get the name and parameters. * * @param string $middleware * @return array */ protected function parseMiddleware($middleware) { [$name, $parameters] = array_pad(explode(':', $middleware, 2), 2, []); if (is_string($parameters)) { $parameters = explode(',', $parameters); } return [$name, $parameters]; } /** * Determine if the kernel has a given middleware. * * @param string $middleware * @return bool */ public function hasMiddleware($middleware) { return in_array($middleware, $this->middleware); } /** * Add a new middleware to the beginning of the stack if it does not already exist. * * @param string $middleware * @return $this */ public function prependMiddleware($middleware) { if (array_search($middleware, $this->middleware) === false) { array_unshift($this->middleware, $middleware); } return $this; } /** * Add a new middleware to end of the stack if it does not already exist. * * @param string $middleware * @return $this */ public function pushMiddleware($middleware) { if (array_search($middleware, $this->middleware) === false) { $this->middleware[] = $middleware; } return $this; } /** * Prepend the given middleware to the given middleware group. * * @param string $group * @param string $middleware * @return $this * * @throws \InvalidArgumentException */ public function prependMiddlewareToGroup($group, $middleware) { if (! isset($this->middlewareGroups[$group])) { throw new InvalidArgumentException("The [{$group}] middleware group has not been defined."); } if (array_search($middleware, $this->middlewareGroups[$group]) === false) { array_unshift($this->middlewareGroups[$group], $middleware); } $this->syncMiddlewareToRouter(); return $this; } /** * Append the given middleware to the given middleware group. * * @param string $group * @param string $middleware * @return $this * * @throws \InvalidArgumentException */ public function appendMiddlewareToGroup($group, $middleware) { if (! isset($this->middlewareGroups[$group])) { throw new InvalidArgumentException("The [{$group}] middleware group has not been defined."); } if (array_search($middleware, $this->middlewareGroups[$group]) === false) { $this->middlewareGroups[$group][] = $middleware; } $this->syncMiddlewareToRouter(); return $this; } /** * Prepend the given middleware to the middleware priority list. * * @param string $middleware * @return $this */ public function prependToMiddlewarePriority($middleware) { if (! in_array($middleware, $this->middlewarePriority)) { array_unshift($this->middlewarePriority, $middleware); } $this->syncMiddlewareToRouter(); return $this; } /** * Append the given middleware to the middleware priority list. * * @param string $middleware * @return $this */ public function appendToMiddlewarePriority($middleware) { if (! in_array($middleware, $this->middlewarePriority)) { $this->middlewarePriority[] = $middleware; } $this->syncMiddlewareToRouter(); return $this; } /** * Sync the current state of the middleware to the router. * * @return void */ protected function syncMiddlewareToRouter() { $this->router->middlewarePriority = $this->middlewarePriority; foreach ($this->middlewareGroups as $key => $middleware) { $this->router->middlewareGroup($key, $middleware); } foreach (array_merge($this->routeMiddleware, $this->middlewareAliases) as $key => $middleware) { $this->router->aliasMiddleware($key, $middleware); } } /** * Get the priority-sorted list of middleware. * * @return array */ public function getMiddlewarePriority() { return $this->middlewarePriority; } /** * Get the bootstrap classes for the application. * * @return array */ protected function bootstrappers() { return $this->bootstrappers; } /** * Report the exception to the exception handler. * * @param \Throwable $e * @return void */ protected function reportException(Throwable $e) { $this->app[ExceptionHandler::class]->report($e); } /** * Render the exception to a response. * * @param \Illuminate\Http\Request $request * @param \Throwable $e * @return \Symfony\Component\HttpFoundation\Response */ protected function renderException($request, Throwable $e) { return $this->app[ExceptionHandler::class]->render($request, $e); } /** * Get the application's route middleware groups. * * @return array */ public function getMiddlewareGroups() { return $this->middlewareGroups; } /** * Get the application's route middleware aliases. * * @return array * * @deprecated */ public function getRouteMiddleware() { return $this->getMiddlewareAliases(); } /** * Get the application's route middleware aliases. * * @return array */ public function getMiddlewareAliases() { return array_merge($this->routeMiddleware, $this->middlewareAliases); } /** * Get the Laravel application instance. * * @return \Illuminate\Contracts\Foundation\Application */ public function getApplication() { return $this->app; } /** * Set the Laravel application instance. * * @param \Illuminate\Contracts\Foundation\Application $app * @return $this */ public function setApplication(Application $app) { $this->app = $app; return $this; } } PKO$W]¤àUAmm8src/Illuminate/Foundation/Http/Events/RequestHandled.phpnu„[µü¤request = $request; $this->response = $response; } } PKO$W]¡’F)OO-src/Illuminate/Foundation/Http/HtmlDumper.phpnu„[µü¤'; /** * Where the source should be placed on "non expanded" kind of dumps. * * @var string */ const NON_EXPANDED_SEPARATOR = "\n