Created
June 12, 2025 23:44
-
-
Save ace-of-aces/6fccf0b80d3f1fba98f7d1ade754002f to your computer and use it in GitHub Desktop.
All Laravel Helper Functions as Emojis ๐ค
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use Illuminate\Broadcasting\FakePendingBroadcast; | |
| use Illuminate\Container\Container; | |
| use Illuminate\Contracts\Auth\Access\Gate; | |
| use Illuminate\Contracts\Auth\Factory as AuthFactory; | |
| use Illuminate\Contracts\Broadcasting\Factory as BroadcastFactory; | |
| use Illuminate\Contracts\Bus\Dispatcher; | |
| use Illuminate\Contracts\Cookie\Factory as CookieFactory; | |
| use Illuminate\Contracts\Debug\ExceptionHandler; | |
| use Illuminate\Contracts\Routing\ResponseFactory; | |
| use Illuminate\Contracts\Routing\UrlGenerator; | |
| use Illuminate\Contracts\Support\Responsable; | |
| use Illuminate\Contracts\Validation\Factory as ValidationFactory; | |
| use Illuminate\Contracts\View\Factory as ViewFactory; | |
| use Illuminate\Foundation\Bus\PendingClosureDispatch; | |
| use Illuminate\Foundation\Bus\PendingDispatch; | |
| use Illuminate\Foundation\Mix; | |
| use Illuminate\Http\Exceptions\HttpResponseException; | |
| use Illuminate\Log\Context\Repository as ContextRepository; | |
| use Illuminate\Queue\CallQueuedClosure; | |
| use Illuminate\Routing\Router; | |
| use Illuminate\Support\Facades\Date; | |
| use Illuminate\Support\Facades\Route; | |
| use Illuminate\Support\HtmlString; | |
| use Illuminate\Support\Uri; | |
| use League\Uri\Contracts\UriInterface; | |
| use Symfony\Component\HttpFoundation\Response; | |
| use Symfony\Component\VarDumper\Caster\ScalarStub; | |
| use Symfony\Component\VarDumper\VarDumper; | |
| /** | |
| * Aliased Laravel helpers | |
| */ | |
| if (! function_exists('๐ซ')) { | |
| /** | |
| * Throw an HttpException with the given data. | |
| * | |
| * @param \Symfony\Component\HttpFoundation\Response|\Illuminate\Contracts\Support\Responsable|int $code | |
| * @param string $message | |
| * @return never | |
| * | |
| * @throws \Symfony\Component\HttpKernel\Exception\HttpException | |
| * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException | |
| * @throws \Illuminate\Http\Exceptions\HttpResponseException | |
| */ | |
| function ๐ซ($code, $message = '', array $headers = []) | |
| { | |
| if ($code instanceof Response) { | |
| throw new HttpResponseException($code); | |
| } elseif ($code instanceof Responsable) { | |
| throw new HttpResponseException($code->toResponse(request())); | |
| } | |
| app()->abort($code, $message, $headers); | |
| } | |
| } | |
| if (! function_exists('๐ซโ')) { | |
| /** | |
| * 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 | |
| * @return void | |
| * | |
| * @throws \Symfony\Component\HttpKernel\Exception\HttpException | |
| * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException | |
| */ | |
| function ๐ซโ($boolean, $code, $message = '', array $headers = []) | |
| { | |
| if ($boolean) { | |
| abort($code, $message, $headers); | |
| } | |
| } | |
| } | |
| if (! function_exists('๐ซโ๏ธ')) { | |
| /** | |
| * 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 | |
| * @return void | |
| * | |
| * @throws \Symfony\Component\HttpKernel\Exception\HttpException | |
| * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException | |
| */ | |
| function ๐ซโ๏ธ($boolean, $code, $message = '', array $headers = []) | |
| { | |
| if (! $boolean) { | |
| abort($code, $message, $headers); | |
| } | |
| } | |
| } | |
| if (! function_exists('๐จ')) { | |
| /** | |
| * Generate the URL to a controller action. | |
| * | |
| * @param string|array $name | |
| * @param mixed $parameters | |
| * @param bool $absolute | |
| * @return string | |
| */ | |
| function ๐จ($name, $parameters = [], $absolute = true) | |
| { | |
| return app('url')->action($name, $parameters, $absolute); | |
| } | |
| } | |
| if (! function_exists('๐ ฐ๏ธ')) { | |
| /** | |
| * Get the available container instance. | |
| * | |
| * @template TClass of object | |
| * | |
| * @param string|class-string<TClass>|null $abstract | |
| * @return ($abstract is class-string<TClass> ? TClass : ($abstract is null ? \Illuminate\Foundation\Application : mixed)) | |
| */ | |
| function ๐ ฐ๏ธ($abstract = null, array $parameters = []) | |
| { | |
| if (is_null($abstract)) { | |
| return Container::getInstance(); | |
| } | |
| return Container::getInstance()->make($abstract, $parameters); | |
| } | |
| } | |
| if (! function_exists('๐ ฐ๏ธ๐ฃ๏ธ')) { | |
| /** | |
| * Get the path to the application folder. | |
| * | |
| * @param string $path | |
| * @return string | |
| */ | |
| function ๐ ฐ๏ธ๐ฃ๏ธ($path = '') | |
| { | |
| return app()->path($path); | |
| } | |
| } | |
| if (! function_exists('๐')) { | |
| /** | |
| * Generate an asset path for the application. | |
| * | |
| * @param string $path | |
| * @param bool|null $secure | |
| * @return string | |
| */ | |
| function ๐($path, $secure = null) | |
| { | |
| return app('url')->asset($path, $secure); | |
| } | |
| } | |
| if (! function_exists('๐ชช')) { | |
| /** | |
| * Get the available auth instance. | |
| * | |
| * @param string|null $guard | |
| * @return ($guard is null ? \Illuminate\Contracts\Auth\Factory : \Illuminate\Contracts\Auth\StatefulGuard) | |
| */ | |
| function ๐ชช($guard = null) | |
| { | |
| if (is_null($guard)) { | |
| return app(AuthFactory::class); | |
| } | |
| return app(AuthFactory::class)->guard($guard); | |
| } | |
| } | |
| if (! function_exists('๐๐ป')) { | |
| /** | |
| * Create a new redirect response to the previous location. | |
| * | |
| * @param int $status | |
| * @param array $headers | |
| * @param mixed $fallback | |
| * @return \Illuminate\Http\RedirectResponse | |
| */ | |
| function ๐๐ป($status = 302, $headers = [], $fallback = false) | |
| { | |
| return app('redirect')->back($status, $headers, $fallback); | |
| } | |
| } | |
| if (! function_exists('๐ฟ๐ฃ๏ธ')) { | |
| /** | |
| * Get the path to the base of the install. | |
| * | |
| * @param string $path | |
| * @return string | |
| */ | |
| function ๐ฟ๐ฃ๏ธ($path = '') | |
| { | |
| return app()->basePath($path); | |
| } | |
| } | |
| if (! function_exists('๐ง๐ปโโ๏ธ')) { | |
| /** | |
| * Hash the given value against the bcrypt algorithm. | |
| * | |
| * @param string $value | |
| * @param array $options | |
| * @return string | |
| */ | |
| function ๐ง๐ปโโ๏ธ($value, $options = []) | |
| { | |
| return app('hash')->driver('bcrypt')->make($value, $options); | |
| } | |
| } | |
| if (! function_exists('๐ก')) { | |
| /** | |
| * Begin broadcasting an event. | |
| * | |
| * @param mixed|null $event | |
| * @return \Illuminate\Broadcasting\PendingBroadcast | |
| */ | |
| function ๐ก($event = null) | |
| { | |
| return app(BroadcastFactory::class)->event($event); | |
| } | |
| } | |
| if (! function_exists('๐กโ')) { | |
| /** | |
| * Begin broadcasting an event if the given condition is true. | |
| * | |
| * @param bool $boolean | |
| * @param mixed|null $event | |
| * @return \Illuminate\Broadcasting\PendingBroadcast | |
| */ | |
| function ๐กโ($boolean, $event = null) | |
| { | |
| if ($boolean) { | |
| return app(BroadcastFactory::class)->event($event); | |
| } else { | |
| return new FakePendingBroadcast; | |
| } | |
| } | |
| } | |
| if (! function_exists('๐กโ๏ธ')) { | |
| /** | |
| * Begin broadcasting an event unless the given condition is true. | |
| * | |
| * @param bool $boolean | |
| * @param mixed|null $event | |
| * @return \Illuminate\Broadcasting\PendingBroadcast | |
| */ | |
| function ๐กโ๏ธ($boolean, $event = null) | |
| { | |
| if (! $boolean) { | |
| return app(BroadcastFactory::class)->event($event); | |
| } else { | |
| return new FakePendingBroadcast; | |
| } | |
| } | |
| } | |
| if (! function_exists('๐')) { | |
| /** | |
| * Get / set the specified cache value. | |
| * | |
| * If an array is passed, we'll assume you want to put to the cache. | |
| * | |
| * @param string|array<string, mixed>|null $key key|data | |
| * @param mixed $default default|expiration|null | |
| * @return ($key is null ? \Illuminate\Cache\CacheManager : ($key is string ? mixed : bool)) | |
| * | |
| * @throws \InvalidArgumentException | |
| */ | |
| function ๐($key = null, $default = null) | |
| { | |
| if (is_null($key)) { | |
| return app('cache'); | |
| } | |
| if (is_string($key)) { | |
| return app('cache')->get($key, $default); | |
| } | |
| if (! is_array($key)) { | |
| throw new InvalidArgumentException( | |
| 'When setting a value in the cache, you must pass an array of key / value pairs.' | |
| ); | |
| } | |
| return app('cache')->put(key($key), reset($key), ttl: $default); | |
| } | |
| } | |
| if (! function_exists('๐ง')) { | |
| /** | |
| * 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, mixed>|string|null $key | |
| * @param mixed $default | |
| * @return ($key is null ? \Illuminate\Config\Repository : ($key is string ? mixed : null)) | |
| */ | |
| function ๐ง($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('๐ง๐ฃ๏ธ')) { | |
| /** | |
| * Get the configuration path. | |
| * | |
| * @param string $path | |
| * @return string | |
| */ | |
| function ๐ง๐ฃ๏ธ($path = '') | |
| { | |
| return app()->configPath($path); | |
| } | |
| } | |
| if (! function_exists('๐ง ')) { | |
| /** | |
| * Get / set the specified context value. | |
| * | |
| * @param array|string|null $key | |
| * @param mixed $default | |
| * @return ($key is string ? mixed : \Illuminate\Log\Context\Repository) | |
| */ | |
| function ๐ง ($key = null, $default = null) | |
| { | |
| $context = app(ContextRepository::class); | |
| return match (true) { | |
| is_null($key) => $context, | |
| is_array($key) => $context->add($key), | |
| default => $context->get($key, $default), | |
| }; | |
| } | |
| } | |
| if (! function_exists('๐ช')) { | |
| /** | |
| * 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 ($name is null ? \Illuminate\Cookie\CookieJar : \Symfony\Component\HttpFoundation\Cookie) | |
| */ | |
| function ๐ช($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('๐ช๐ณ')) { | |
| /** | |
| * Generate a CSRF token form field. | |
| * | |
| * @return \Illuminate\Support\HtmlString | |
| */ | |
| function ๐ช๐ณ() | |
| { | |
| return new HtmlString('<input type="hidden" name="_token" value="'.csrf_token().'" autocomplete="off">'); | |
| } | |
| } | |
| if (! function_exists('๐ช๐')) { | |
| /** | |
| * Get the CSRF token value. | |
| * | |
| * @return string | |
| * | |
| * @throws \RuntimeException | |
| */ | |
| function ๐ช๐() | |
| { | |
| $session = app('session'); | |
| if (isset($session)) { | |
| return $session->token(); | |
| } | |
| throw new RuntimeException('Application session store not set.'); | |
| } | |
| } | |
| if (! function_exists('๐๐ฃ๏ธ')) { | |
| /** | |
| * Get the database path. | |
| * | |
| * @param string $path | |
| * @return string | |
| */ | |
| function ๐๐ฃ๏ธ($path = '') | |
| { | |
| return app()->databasePath($path); | |
| } | |
| } | |
| if (! function_exists('๐')) { | |
| /** | |
| * Decrypt the given value. | |
| * | |
| * @param string $value | |
| * @param bool $unserialize | |
| * @return mixed | |
| */ | |
| function ๐($value, $unserialize = true) | |
| { | |
| return app('encrypter')->decrypt($value, $unserialize); | |
| } | |
| } | |
| if (! function_exists('๐ฅฑ')) { | |
| /** | |
| * Defer execution of the given callback. | |
| * | |
| * @return \Illuminate\Support\Defer\DeferredCallback | |
| */ | |
| function ๐ฅฑ(?callable $callback = null, ?string $name = null, bool $always = false) | |
| { | |
| return \Illuminate\Support\defer($callback, $name, $always); | |
| } | |
| } | |
| if (! function_exists('๐')) { | |
| /** | |
| * Dispatch a job to its appropriate handler. | |
| * | |
| * @param mixed $job | |
| * @return ($job is \Closure ? \Illuminate\Foundation\Bus\PendingClosureDispatch : \Illuminate\Foundation\Bus\PendingDispatch) | |
| */ | |
| function ๐($job) | |
| { | |
| return $job instanceof Closure | |
| ? new PendingClosureDispatch(CallQueuedClosure::create($job)) | |
| : new PendingDispatch($job); | |
| } | |
| } | |
| if (! function_exists('๐๐')) { | |
| /** | |
| * 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 ๐๐($job, $handler = null) | |
| { | |
| return app(Dispatcher::class)->dispatchSync($job, $handler); | |
| } | |
| } | |
| if (! function_exists('๐')) { | |
| /** | |
| * Encrypt the given value. | |
| * | |
| * @param mixed $value | |
| * @param bool $serialize | |
| * @return string | |
| */ | |
| function ๐($value, $serialize = true) | |
| { | |
| return app('encrypter')->encrypt($value, $serialize); | |
| } | |
| } | |
| if (! function_exists('๐')) { | |
| /** | |
| * Dispatch an event and call the listeners. | |
| * | |
| * @param string|object $event | |
| * @param mixed $payload | |
| * @param bool $halt | |
| * @return array|null | |
| */ | |
| function ๐(...$args) | |
| { | |
| return app('events')->dispatch(...$args); | |
| } | |
| } | |
| if (! function_exists('๐ญ') && class_exists(\Faker\Factory::class)) { | |
| /** | |
| * Get a faker instance. | |
| * | |
| * @param string|null $locale | |
| * @return \Faker\Generator | |
| */ | |
| function ๐ญ($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('โน๏ธ')) { | |
| /** | |
| * Write some information to the log. | |
| * | |
| * @param string $message | |
| * @param array $context | |
| * @return void | |
| */ | |
| function โน๏ธ($message, $context = []) | |
| { | |
| app('log')->info($message, $context); | |
| } | |
| } | |
| if (! function_exists('๐๏ธ')) { | |
| /** | |
| * Log a debug message to the logs. | |
| * | |
| * @param string|null $message | |
| * @return ($message is null ? \Illuminate\Log\LogManager : null) | |
| */ | |
| function ๐๏ธ($message = null, array $context = []) | |
| { | |
| if (is_null($message)) { | |
| return app('log'); | |
| } | |
| return app('log')->debug($message, $context); | |
| } | |
| } | |
| if (! function_exists('๐ค๐ฃ๏ธ')) { | |
| /** | |
| * Get the path to the language folder. | |
| * | |
| * @param string $path | |
| * @return string | |
| */ | |
| function ๐ค๐ฃ๏ธ($path = '') | |
| { | |
| return app()->langPath($path); | |
| } | |
| } | |
| if (! function_exists('๐')) { | |
| /** | |
| * Get a log driver instance. | |
| * | |
| * @param string|null $driver | |
| * @return ($driver is null ? \Illuminate\Log\LogManager : \Psr\Log\LoggerInterface) | |
| */ | |
| function ๐($driver = null) | |
| { | |
| return $driver ? app('log')->driver($driver) : app('log'); | |
| } | |
| } | |
| if (! function_exists('๐ณ๐ณ')) { | |
| /** | |
| * Generate a form field to spoof the HTTP verb used by forms. | |
| * | |
| * @param string $method | |
| * @return \Illuminate\Support\HtmlString | |
| */ | |
| function ๐ณ๐ณ($method) | |
| { | |
| return new HtmlString('<input type="hidden" name="_method" value="'.$method.'">'); | |
| } | |
| } | |
| if (! function_exists('๐น')) { | |
| /** | |
| * Get the path to a versioned Mix file. | |
| * | |
| * @param string $path | |
| * @param string $manifestDirectory | |
| * @return \Illuminate\Support\HtmlString|string | |
| * | |
| * @throws \Exception | |
| */ | |
| function ๐น($path, $manifestDirectory = '') | |
| { | |
| return app(Mix::class)(...func_get_args()); | |
| } | |
| } | |
| if (! function_exists('โฐ')) { | |
| /** | |
| * Create a new Carbon instance for the current time. | |
| * | |
| * @param \DateTimeZone|string|null $tz | |
| * @return \Illuminate\Support\Carbon | |
| */ | |
| function โฐ($tz = null) | |
| { | |
| return Date::now($tz); | |
| } | |
| } | |
| if (! function_exists('๐ต๐ป')) { | |
| /** | |
| * Retrieve an old input item. | |
| * | |
| * @param string|null $key | |
| * @param \Illuminate\Database\Eloquent\Model|string|array|null $default | |
| * @return string|array|null | |
| */ | |
| function ๐ต๐ป($key = null, $default = null) | |
| { | |
| return app('request')->old($key, $default); | |
| } | |
| } | |
| if (! function_exists('๐ฎ๐ป')) { | |
| /** | |
| * Get a policy instance for a given class. | |
| * | |
| * @param object|string $class | |
| * @return mixed | |
| * | |
| * @throws \InvalidArgumentException | |
| */ | |
| function ๐ฎ๐ป($class) | |
| { | |
| return app(Gate::class)->getPolicyFor($class); | |
| } | |
| } | |
| if (! function_exists('๐ฎ')) { | |
| /** | |
| * Handle a Precognition controller hook. | |
| * | |
| * @param null|callable $callable | |
| * @return mixed | |
| */ | |
| function ๐ฎ($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('๐ข๐ฃ๏ธ')) { | |
| /** | |
| * Get the path to the public folder. | |
| * | |
| * @param string $path | |
| * @return string | |
| */ | |
| function ๐ข๐ฃ๏ธ($path = '') | |
| { | |
| return app()->publicPath($path); | |
| } | |
| } | |
| if (! function_exists('๐')) { | |
| /** | |
| * Get an instance of the redirector. | |
| * | |
| * @param string|null $to | |
| * @param int $status | |
| * @param array $headers | |
| * @param bool|null $secure | |
| * @return ($to is null ? \Illuminate\Routing\Redirector : \Illuminate\Http\RedirectResponse) | |
| */ | |
| function ๐($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 an exception. | |
| * | |
| * @param \Throwable|string $exception | |
| * @return void | |
| */ | |
| function ๐จ($exception) | |
| { | |
| if (is_string($exception)) { | |
| $exception = new Exception($exception); | |
| } | |
| app(ExceptionHandler::class)->report($exception); | |
| } | |
| } | |
| if (! function_exists('๐จโ')) { | |
| /** | |
| * Report an exception if the given condition is true. | |
| * | |
| * @param bool $boolean | |
| * @param \Throwable|string $exception | |
| * @return void | |
| */ | |
| function ๐จโ($boolean, $exception) | |
| { | |
| if ($boolean) { | |
| report($exception); | |
| } | |
| } | |
| } | |
| if (! function_exists('๐จโ๏ธ')) { | |
| /** | |
| * Report an exception unless the given condition is true. | |
| * | |
| * @param bool $boolean | |
| * @param \Throwable|string $exception | |
| * @return void | |
| */ | |
| function ๐จโ๏ธ($boolean, $exception) | |
| { | |
| if (! $boolean) { | |
| report($exception); | |
| } | |
| } | |
| } | |
| if (! function_exists('๐๏ธ')) { | |
| /** | |
| * Get an instance of the current request or an input item from the request. | |
| * | |
| * @param list<string>|string|null $key | |
| * @param mixed $default | |
| * @return ($key is null ? \Illuminate\Http\Request : ($key is string ? mixed : array<string, mixed>)) | |
| */ | |
| function ๐๏ธ($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('๐')) { | |
| /** | |
| * Catch a potential exception and return a default value. | |
| * | |
| * @template TValue | |
| * @template TFallback | |
| * | |
| * @param callable(): TValue $callback | |
| * @param (callable(\Throwable): TFallback)|TFallback $rescue | |
| * @param bool|callable(\Throwable): bool $report | |
| * @return TValue|TFallback | |
| */ | |
| function ๐(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 a service from the container. | |
| * | |
| * @template TClass of object | |
| * | |
| * @param string|class-string<TClass> $name | |
| * @return ($name is class-string<TClass> ? TClass : mixed) | |
| */ | |
| function ๐ฆ($name, array $parameters = []) | |
| { | |
| return app($name, $parameters); | |
| } | |
| } | |
| if (! function_exists('๐ข๏ธ๐ฃ๏ธ')) { | |
| /** | |
| * Get the path to the resources folder. | |
| * | |
| * @param string $path | |
| * @return string | |
| */ | |
| function ๐ข๏ธ๐ฃ๏ธ($path = '') | |
| { | |
| return app()->resourcePath($path); | |
| } | |
| } | |
| if (! function_exists('๐ฃ๏ธ')) { | |
| /** | |
| * Return a new response from the application. | |
| * | |
| * @param \Illuminate\Contracts\View\View|string|array|null $content | |
| * @param int $status | |
| * @return ($content is null ? \Illuminate\Contracts\Routing\ResponseFactory : \Illuminate\Http\Response) | |
| */ | |
| function ๐ฃ๏ธ($content = null, $status = 200, array $headers = []) | |
| { | |
| $factory = app(ResponseFactory::class); | |
| if (func_num_args() === 0) { | |
| return $factory; | |
| } | |
| return $factory->make($content ?? '', $status, $headers); | |
| } | |
| } | |
| if (! function_exists('๐งญ')) { | |
| /** | |
| * Generate the URL to a named route. | |
| * | |
| * @param \BackedEnum|string $name | |
| * @param mixed $parameters | |
| * @param bool $absolute | |
| * @return string | |
| */ | |
| function ๐งญ($name, $parameters = [], $absolute = true) | |
| { | |
| return app('url')->route($name, $parameters, $absolute); | |
| } | |
| } | |
| if (! function_exists('๐๐')) { | |
| /** | |
| * Generate an asset path for the application. | |
| * | |
| * @param string $path | |
| * @return string | |
| */ | |
| function ๐๐($path) | |
| { | |
| return asset($path, true); | |
| } | |
| } | |
| if (! function_exists('๐๐')) { | |
| /** | |
| * Generate a HTTPS url for the application. | |
| * | |
| * @param string $path | |
| * @param mixed $parameters | |
| * @return string | |
| */ | |
| function ๐๐($path, $parameters = []) | |
| { | |
| return url($path, $parameters, true); | |
| } | |
| } | |
| if (! function_exists('๐')) { | |
| /** | |
| * 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, mixed>|string|null $key | |
| * @param mixed $default | |
| * @return ($key is null ? \Illuminate\Session\SessionManager : ($key is string ? mixed : null)) | |
| */ | |
| function ๐($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('๐ชฃ๐ฃ๏ธ')) { | |
| /** | |
| * Get the path to the storage folder. | |
| * | |
| * @param string $path | |
| * @return string | |
| */ | |
| function ๐ชฃ๐ฃ๏ธ($path = '') | |
| { | |
| return app()->storagePath($path); | |
| } | |
| } | |
| if (! function_exists('โก๏ธ๐งญ')) { | |
| /** | |
| * Create a new redirect response to a named route. | |
| * | |
| * @param \BackedEnum|string $route | |
| * @param mixed $parameters | |
| * @param int $status | |
| * @param array $headers | |
| * @return \Illuminate\Http\RedirectResponse | |
| */ | |
| function โก๏ธ๐งญ($route, $parameters = [], $status = 302, $headers = []) | |
| { | |
| return redirect()->route($route, $parameters, $status, $headers); | |
| } | |
| } | |
| if (! function_exists('๐ ')) { | |
| /** | |
| * Create a new Carbon instance for the current date. | |
| * | |
| * @param \DateTimeZone|string|null $tz | |
| * @return \Illuminate\Support\Carbon | |
| */ | |
| function ๐ ($tz = null) | |
| { | |
| return Date::today($tz); | |
| } | |
| } | |
| if (! function_exists('๐')) { | |
| /** | |
| * Translate the given message. | |
| * | |
| * @param string|null $key | |
| * @param array $replace | |
| * @param string|null $locale | |
| * @return ($key is null ? \Illuminate\Contracts\Translation\Translator : array|string) | |
| */ | |
| function ๐($key = null, $replace = [], $locale = null) | |
| { | |
| if (is_null($key)) { | |
| return app('translator'); | |
| } | |
| return app('translator')->get($key, $replace, $locale); | |
| } | |
| } | |
| if (! function_exists('๐๐')) { | |
| /** | |
| * Translates the given message based on a count. | |
| * | |
| * @param string $key | |
| * @param \Countable|int|float|array $number | |
| * @param string|null $locale | |
| * @return string | |
| */ | |
| function ๐๐($key, $number, array $replace = [], $locale = null) | |
| { | |
| return app('translator')->choice($key, $number, $replace, $locale); | |
| } | |
| } | |
| if (! function_exists('๐โ๏ธ')) { | |
| /** | |
| * Generate a URI for the application. | |
| */ | |
| function ๐โ๏ธ(UriInterface|Stringable|array|string $uri, mixed $parameters = [], bool $absolute = true): Uri | |
| { | |
| return match (true) { | |
| is_array($uri) || str_contains($uri, '\\') => Uri::action($uri, $parameters, $absolute), | |
| str_contains($uri, '.') && Route::has($uri) => Uri::route($uri, $parameters, $absolute), | |
| default => Uri::of($uri), | |
| }; | |
| } | |
| } | |
| if (! function_exists('๐')) { | |
| /** | |
| * Generate a URL for the application. | |
| * | |
| * @param string|null $path | |
| * @param mixed $parameters | |
| * @param bool|null $secure | |
| * @return ($path is null ? \Illuminate\Contracts\Routing\UrlGenerator : string) | |
| */ | |
| function ๐($path = null, $parameters = [], $secure = null) | |
| { | |
| if (is_null($path)) { | |
| return app(UrlGenerator::class); | |
| } | |
| return app(UrlGenerator::class)->to($path, $parameters, $secure); | |
| } | |
| } | |
| if (! function_exists('๐ง')) { | |
| /** | |
| * Create a new Validator instance. | |
| * | |
| * @return ($data is null ? \Illuminate\Contracts\Validation\Factory : \Illuminate\Contracts\Validation\Validator) | |
| */ | |
| function ๐ง(?array $data = null, 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('๐ช')) { | |
| /** | |
| * Get the evaluated view contents for the given view. | |
| * | |
| * @param string|null $view | |
| * @param \Illuminate\Contracts\Support\Arrayable|array $data | |
| * @param array $mergeData | |
| * @return ($view is null ? \Illuminate\Contracts\View\Factory : \Illuminate\Contracts\View\View) | |
| */ | |
| function ๐ช($view = null, $data = [], $mergeData = []) | |
| { | |
| $factory = app(ViewFactory::class); | |
| if (func_num_args() === 0) { | |
| return $factory; | |
| } | |
| return $factory->make($view, $data, $mergeData); | |
| } | |
| } | |
| /** | |
| * Additional aliased die/dump functions | |
| */ | |
| if (! function_exists('๐ฎ')) { | |
| /** | |
| * @author Nicolas Grekas <p@tchwork.com> | |
| * @author Alexandre Daubois <alex.daubois@gmail.com> | |
| */ | |
| function ๐ฎ(mixed ...$vars): mixed | |
| { | |
| if (! $vars) { | |
| VarDumper::dump(new ScalarStub('๐')); | |
| return null; | |
| } | |
| if (array_key_exists(0, $vars) && count($vars) === 1) { | |
| VarDumper::dump($vars[0]); | |
| $k = 0; | |
| } else { | |
| foreach ($vars as $k => $v) { | |
| VarDumper::dump($v, is_int($k) ? 1 + $k : $k); | |
| } | |
| } | |
| if (count($vars) > 1) { | |
| return $vars; | |
| } | |
| return $vars[$k]; | |
| } | |
| } | |
| if (! function_exists('๐๐ฎ')) { | |
| function ๐๐ฎ(mixed ...$vars): never | |
| { | |
| if (! in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) && ! headers_sent()) { | |
| header('HTTP/1.1 500 Internal Server Error'); | |
| } | |
| if (! $vars) { | |
| VarDumper::dump(new ScalarStub('๐')); | |
| exit(1); | |
| } | |
| if (array_key_exists(0, $vars) && count($vars) === 1) { | |
| VarDumper::dump($vars[0]); | |
| } else { | |
| foreach ($vars as $k => $v) { | |
| VarDumper::dump($v, is_int($k) ? 1 + $k : $k); | |
| } | |
| } | |
| exit(1); | |
| } | |
| } | |
| if (! function_exists('๐')) { | |
| /** | |
| * Exit the process with a given code. | |
| */ | |
| function ๐(int $code = 1) | |
| { | |
| exit($code); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "autoload": { | |
| "files": [ | |
| "app/Helper/emoji.php" | |
| ] | |
| }, | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment