Server IP : / Your IP : 10.244.4.16 [ Web Server : nginx/1.25.3 System : Linux escuela-portal-app-54f56585bc-kst6g 5.15.0-1084-azure #93-Ubuntu SMP Sat Mar 15 14:12:29 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.2.13 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /proc/449/root/var/www/app/vendor/inertiajs/inertia-laravel/src/ |
Upload File : |
<?php namespace Inertia; use Closure; use Illuminate\Support\Arr; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Request; use Illuminate\Support\Traits\Macroable; use Illuminate\Contracts\Support\Arrayable; use Illuminate\Support\Facades\Redirect; use Illuminate\Support\Facades\Response as BaseResponse; use Symfony\Component\HttpFoundation\Response as SymfonyResponse; use Symfony\Component\HttpFoundation\RedirectResponse as SymfonyRedirect; class ResponseFactory { use Macroable; /** @var string */ protected $rootView = 'app'; /** @var array */ protected $sharedProps = []; /** @var Closure|string|null */ protected $version; public function setRootView(string $name): void { $this->rootView = $name; } /** * @param string|array|Arrayable $key * @param mixed $value */ public function share($key, $value = null): void { if (is_array($key)) { $this->sharedProps = array_merge($this->sharedProps, $key); } elseif ($key instanceof Arrayable) { $this->sharedProps = array_merge($this->sharedProps, $key->toArray()); } else { Arr::set($this->sharedProps, $key, $value); } } /** * @param mixed $default * * @return mixed */ public function getShared(string $key = null, $default = null) { if ($key) { return Arr::get($this->sharedProps, $key, $default); } return $this->sharedProps; } public function flushShared(): void { $this->sharedProps = []; } /** * @param Closure|string|null $version */ public function version($version): void { $this->version = $version; } public function getVersion(): string { $version = $this->version instanceof Closure ? App::call($this->version) : $this->version; return (string) $version; } public function lazy(callable $callback): LazyProp { return new LazyProp($callback); } /** * @param array|Arrayable $props */ public function render(string $component, $props = []): Response { if ($props instanceof Arrayable) { $props = $props->toArray(); } return new Response( $component, array_merge($this->sharedProps, $props), $this->rootView, $this->getVersion() ); } /** * @param string|SymfonyRedirect $url */ public function location($url): SymfonyResponse { if (Request::inertia()) { return BaseResponse::make('', 409, ['X-Inertia-Location' => $url instanceof SymfonyRedirect ? $url->getTargetUrl() : $url]); } return $url instanceof SymfonyRedirect ? $url : Redirect::away($url); } }