本文整理汇总了PHP中Route::currentRouteAction方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::currentRouteAction方法的具体用法?PHP Route::currentRouteAction怎么用?PHP Route::currentRouteAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Route
的用法示例。
在下文中一共展示了Route::currentRouteAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getViewName
private function _getViewName()
{
$viewName = strtolower(Route::currentRouteAction());
$viewName = str_replace("@", ".", $viewName);
$viewName = str_replace("controller", "", $viewName);
return $viewName;
}
示例2: __construct
public function __construct()
{
$route = \Route::currentRouteAction();
list($controller, $action) = explode('@', $route);
$this->controller = $controller;
$this->action = $action;
}
示例3: __construct
public function __construct()
{
$this->beforeFilter('auth.admin');
$this->hasUnverifiedUsers = Client::where('is_verified', '=', 0)->count();
$this->hasUsersInWaitlist = Client::where('on_waitlist', '=', 1)->count();
View::share('actionName', explode('@', Route::currentRouteAction())[1]);
$this->userRules = array('email' => 'required|email', 'first_name' => 'required', 'last_name' => 'required');
}
示例4: loadControllerJavascript
/**
* Find the associated Javascript for this controller, if it exists
* @return string javascript filename to load
*/
private function loadControllerJavascript()
{
preg_match('/([a-zA-Z]+)@/iU', \Route::currentRouteAction(), $controller);
$file = strtolower($controller[1]);
if (file_exists(dirname(__FILE__) . "/../../../public/javascripts/{$file}.js")) {
return $file;
}
}
示例5: getController
protected function getController()
{
$controller = \Illuminate\Support\Str::parseCallback(\Route::currentRouteAction(), null)[0];
if (!preg_match('/^App\\\\Http\\\\Controllers\\\\([a-zA-Z\\\\]+)Controller$/', $controller, $controller_matches)) {
throw new \Exception('Could not parse controller.');
}
return strtolower(str_replace('\\', '/', Str::camelCaseToHyphen($controller_matches[1])));
}
示例6: redact
/**
* Redirect to action.
*
* @param string $name
* @param array $parameters
* @param int $status
* @param array $headers
* @param bool $secure
*
* @return Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
*/
function redact($name, $parameters = [], $status = 302, $headers = [], $secure = null)
{
if (preg_match('/^_self@/', $name)) {
$controller = explode('\\', strtok(Route::currentRouteAction(), '@'));
$name = preg_replace('/^_self@/', end($controller) . '@', $name);
}
return redirect(action($name, $parameters), $status, $headers, $secure);
}
示例7: __construct
/**
* Instantiate a new UserManagementController instance.
*/
public function __construct()
{
$this->beforeFilter('auth');
if (Request::segment(4) || strpos(Route::currentRouteAction(), 'create') && Request::segment(3) || strpos(Route::currentRouteAction(), 'store') && Request::segment(3)) {
$this->beforeFilter('auth.manager');
} else {
$this->beforeFilter('auth.admin');
}
}
示例8: filter
/**
* filter 実装
*/
public function filter()
{
list($controller, $method) = explode('@', \Route::currentRouteAction());
$reflectionClass = new \ReflectionClass($controller);
$constant = $reflectionClass->getConstant('SESSION_KEY');
if (!\Session::get($constant)) {
return \Redirect::route($this->redirectForm());
}
}
示例9: __construct
public function __construct()
{
$this->beforeFilter(function () {
$exclude = array("HomeController@getIndex");
$cra = Route::currentRouteAction();
if (Auth::guest() && !in_array($cra, $exclude)) {
return Redirect::action('SteamLoginController@getLogin');
}
});
}
示例10: current_route
function current_route($type)
{
$path = explode('@', Route::currentRouteAction());
$pathc = explode("\\", $path[0]);
if ($type == 'class') {
return strtolower(end($pathc));
} else {
return end($path);
}
}
示例11: check
public function check($name = null)
{
$user = $this->user();
$name = $name ?: \Route::currentRouteAction();
if (is_null($user)) {
return false;
}
if (!method_exists($user, 'hasPermissionTo')) {
return false;
}
if (!$user->hasPermissionTo($name)) {
return false;
}
return true;
}
示例12: interpretException
private function interpretException()
{
$e = $this->exception;
$custom_error = (object) $this->custom_error;
$custom_error->time = date(config('lab1353/errors.format_date', 'd/m/Y H:i:s'));
$custom_error->type = get_class($e);
//$custom_error->code = $e->getCode();
$custom_error->code = $e->getCode() > 0 || empty($e->getStatusCode()) ? $e->getCode() : $e->getStatusCode();
$custom_error->url = request()->url();
$custom_error->route = \Route::currentRouteAction();
$custom_error->file = $e->getFile();
$custom_error->line = $e->getLine();
$custom_error->message = (string) $e->getMessage();
$custom_error->trace = $e->getTrace();
return $custom_error;
}
示例13: index
/**
* @Get("test99999", lilichun123="chun")
*/
public function index()
{
return response(['aa' => '123'], 400);
dd(app(\App\Contracts\IAclModule::class)->routeModuleList());
die;
foreach (\Route::getRoutes() as $item) {
dd($item->getAction());
}
die;
dump(\Route::currentRouteAction());
foreach (\Route::getRoutes() as $item) {
// dd($item);
dump($item->getAction());
}
return '123123';
}
示例14: handle
/**
* Test handler
* @param [type] $request [description]
* @param Closure $next [description]
* @return [type] [description]
*/
public function handle($request, Closure $next)
{
$controller_id = str_replace('/index', '', action("\\" . \Route::currentRouteAction()));
$controller_id = str_replace($controller_id, '', \URL::current());
$controller_id = trim($controller_id, '/');
$perm = \Permission::checkPermission(\Route::currentRouteAction(), $controller_id, false);
if ($perm === true) {
//preceed with the normal request
} else {
if (@\Auth::user()->id) {
\Session::flash('danger', "You do not have permission to do that.");
}
return $perm;
}
return $next($request);
}
示例15: __construct
public function __construct()
{
// Set up some standard body classes for easy CSS targeting
$calledClass = strtolower(get_called_class());
$namespaces = str_ireplace('App\\Http\\Controllers\\', '', $calledClass);
$namespaces = explode('\\', $namespaces);
array_pop($namespaces);
$this->bodyClasses += $namespaces;
$this->bodyClasses[] = str_ireplace('controller', '', class_basename($calledClass));
$action = \Route::currentRouteAction();
$action = substr($action, strpos($action, "@") + 1);
$this->bodyClasses[] = \App\Helpers\Text::camelToDashes(str_ireplace(['get', 'post', 'put', 'delete'], '', $action));
\View::share('bodyClass', implode(' ', $this->bodyClasses));
// The timezone that should be used when displaying information
$this->timezone = 'America/Denver';
\View::share('timezone', $this->timezone);
}