![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/clinic.corals.io/vendor/tightenco/ziggy/src/ |
<?php namespace Tightenco\Ziggy; class BladeRouteGenerator { public static $generated; public static $payload; public function generate($group = null, $nonce = null) { if (! static::$payload) { static::$payload = new Ziggy($group); } $nonce = $nonce ? ' nonce="' . $nonce . '"' : ''; if (static::$generated) { return $this->generateMergeJavascript(json_encode(static::$payload->toArray()['routes']), $nonce); } $ziggy = static::$payload->toJson(); $routeFunction = $this->getRouteFunction(); static::$generated = true; return <<<HTML <script type="text/javascript"{$nonce}> const Ziggy = {$ziggy}; $routeFunction </script> HTML; } private function generateMergeJavascript($json, $nonce) { return <<<HTML <script type="text/javascript"{$nonce}> (function () { const routes = {$json}; Object.assign(Ziggy.routes, routes); })(); </script> HTML; } private function getRouteFilePath() { return __DIR__ . '/../dist/index.js'; } private function getRouteFunction() { if (config()->get('ziggy.skip-route-function')) { return ''; } return file_get_contents($this->getRouteFilePath()); } }