protected function parseRoute($route, $match) { $content = substr($match[0], 1, -1); $replacement = 'any'; if (Str::contains($content, ':')) { list($variable, $pattern) = explode(':', $content); $this->setAttribute($variable, $pattern, $match[1]); $replacement = $pattern; } else { $this->setAttribute($content, 'any', $match[1]); } $search = sprintf('/{\\%s}/', $content); $replace = '(' . $this->patterns[$replacement] . ')'; $route = preg_replace($search, $replace, $route); return $route; }
public function regenerateToken() { $this->put('_token', Str::random(40)); }