private function getExceptionData($exception) { $data = []; $data['host'] = Request::server('HTTP_HOST'); $data['method'] = Request::method(); $data['fullUrl'] = Request::fullUrl(); if (php_sapi_name() === 'cli') { $data['host'] = parse_url(config('app.url'), PHP_URL_HOST); $data['method'] = 'CLI'; } $data['exception'] = $exception->getMessage(); $data['error'] = $exception->getTraceAsString(); $data['line'] = $exception->getLine(); $data['file'] = $exception->getFile(); $data['class'] = get_class($exception); $data['storage'] = array('SERVER' => Request::server(), 'GET' => Request::query(), 'POST' => $_POST, 'FILE' => Request::file(), 'OLD' => Request::hasSession() ? Request::old() : [], 'COOKIE' => Request::cookie(), 'SESSION' => Request::hasSession() ? Session::all() : [], 'HEADERS' => Request::header()); $data['storage'] = array_filter($data['storage']); $count = $this->config['count']; $data['exegutor'] = []; $data['file_lines'] = []; $file = new SplFileObject($data['file']); for ($i = -1 * abs($count); $i <= abs($count); $i++) { list($line, $exegutorLine) = $this->getLineInfo($file, $data['line'], $i); $data['exegutor'][] = $exegutorLine; $data['file_lines'][$data['line'] + $i] = $line; } // to make Symfony exception more readable if ($data['class'] == 'Symfony\\Component\\Debug\\Exception\\FatalErrorException') { preg_match("~^(.+)' in ~", $data['exception'], $matches); if (isset($matches[1])) { $data['exception'] = $matches[1]; } } return $data; }
public function current($uri = false) { if ($uri) { return Request::url(); } return Request::fullUrl(); }
public function active($parent = false) { $path = substr(Request::fullUrl(), strlen(url('/')) + 1); if ($parent) { $p = explode('/', $path); return !empty($p[0]) && $p[0] == $this->path; } return $this->path == $path; }
public function create() { // keep backtrack token in the session one more step of the way. if (Session::has('backTo')) { Session::keep('backTo'); } else { Session::flash('backTo', Request::fullUrl()); } return view('medicine.create'); }
/** * @param string $url * @param string $name * @param string $position * @param array $attributes * * @return $this */ public function link($url, $name, $position = "BL", $attributes = array()) { $base = str_replace(Request::path(), '', strtok(Request::fullUrl(), '?')); $match_url = str_replace($base, '/', strtok($url, '?')); if (Request::path() != $match_url) { $url = Persistence::get($match_url, parse_url($url, PHP_URL_QUERY)); } $attributes = array_merge(array("class" => "btn btn-default"), $attributes); $this->button_container[$position][] = HTML::link($url, $name, $attributes); $this->links[] = $url; return $this; }
public function edit(Journal $journal) { // keep backtrack token in the session one more step of the way. if (Session::has('backTo')) { Session::keep('backTo'); } else { Session::flash('backTo', Request::fullUrl()); } $journal = $journal->load('triggers'); // Create list with name=>id to use in select2 field. $triggers = Auth::user()->triggers()->lists('name', 'id'); $medicines = Auth::user()->medicines()->lists('name', 'id'); $common_triggers = CommonTriggers::all()->lists('name', 'id'); // $pain_locations = PainLocations::all()->lists('name', 'id'); return view('journal.edit', compact('journal', 'common_triggers', 'triggers', 'medicines')); }
/** * Get the current request's route if available. * * @return string */ protected function getCurrentUrl() { if (App::runningInConsole()) { return 'console'; } return Request::fullUrl(); }
public static function save() { Session::put('rapyd.' . Request::path(), Request::fullUrl()); }
/** * Reset or save index parameters * * @param string $module * @param array $possibleParameters * @return boolean */ public static function resetSaveIndexParameters($module, $possibleParameters = ['search', 'orderbycolumn', 'orderbytype', 'relation']) { /** * Get common parameters */ $allParameters = Request::all(); /** * Parse existing parameters */ foreach ($allParameters as $parameter => $value) { $cacheKey = implode('.', [$module, Auth::user()->id, $parameter]); /** * Reset */ if (empty($value) == TRUE) { Cache::forget($cacheKey); unset($allParameters[$parameter]); } else { Cache::forever($cacheKey, $value); } } /** * Get new from cache */ foreach ($possibleParameters as $parameter => $value) { $cacheKey = implode('.', [$module, Auth::user()->id, $value]); $allParameters[$value] = Cache::get($cacheKey); } /** * Sort parameters */ ksort($allParameters); ksort($possibleParameters); /** * Redirect ? */ $newRoute = trim(route($module . '.index', $allParameters), "?"); $oldRoute = Request::fullUrl(); /** * Routes are the same, everything is OK */ if ($newRoute == $oldRoute) { return FALSE; } else { return $newRoute; } }
/** * enable auto-back feature on given actions * @param string $actions * @param string $uri * @return $this */ public function back($actions = 'insert|update|do_delete', $url = "") { if ($url == "") { if (count($this->links)) { $url = array_pop($this->links); } else { return $this; } } else { $base = str_replace(Request::path(), '', strtok(Request::fullUrl(), '?')); $match_url = str_replace($base, '/', strtok($url, '?')); if (Request::path() != $match_url) { $url = Persistence::get($match_url); } } $this->back_on = explode("|", $actions); $this->back_url = $url; return $this; }
public function index() { $triggers = Auth::user()->triggers; Session::flash('backTo', Request::fullUrl()); return view('trigger.index', compact('triggers')); }
/** * Overrides the base form open method to allow for automatic insertion of csrf tokens * and form class * * @param null $action Defaults to the current url * @param string $method Defaults to POST * @param array $attributes * @return string */ public function open($action = null, $method = 'POST', $attributes = array()) { // If an action has not been specified, use the current url $action = $action ?: Request::fullUrl(); // Add in the form class if necessary if (empty($attributes['class'])) { $attributes['class'] = $this->getOption('formClass'); } elseif (strpos($attributes['class'], 'form-') === false) { $attributes['class'] .= ' ' . $this->getOption('formClass'); } // Auto-complete attribute if (empty($attributes['autocomplete'])) { $attributes['autocomplete'] = $this->getOption('autocomplete'); } // Laravel's form builder uses a single array as a parameter $attributes['url'] = $action; $attributes['method'] = $method; return Form::open($attributes); }