currentRouteAction() public static method

Get the current route action.
public static currentRouteAction ( ) : string | null
return string | null
 private function _getViewName()
 {
     $viewName = strtolower(Route::currentRouteAction());
     $viewName = str_replace("@", ".", $viewName);
     $viewName = str_replace("controller", "", $viewName);
     return $viewName;
 }
 public function __construct()
 {
     $route = \Route::currentRouteAction();
     list($controller, $action) = explode('@', $route);
     $this->controller = $controller;
     $this->action = $action;
 }
Esempio n. 3
0
 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');
 }
Esempio n. 4
0
 /**
  * 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;
     }
 }
Esempio n. 5
0
 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])));
 }
Esempio n. 6
0
 /**
  * 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);
 }
 /**
  * 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');
     }
 }
 /**
  * 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());
     }
 }
Esempio n. 9
0
 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');
         }
     });
 }
Esempio n. 10
0
function current_route($type)
{
    $path = explode('@', Route::currentRouteAction());
    $pathc = explode("\\", $path[0]);
    if ($type == 'class') {
        return strtolower(end($pathc));
    } else {
        return end($path);
    }
}
Esempio n. 11
0
 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;
 }
Esempio n. 12
0
 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;
 }
Esempio n. 13
0
 /**
  * @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';
 }
Esempio n. 14
0
 /**
  * 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);
 }
Esempio n. 15
0
 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);
 }
Esempio n. 16
0
 public function __construct()
 {
     $this->currentAction = array_get(explode('@', \Route::currentRouteAction()), 1, '');
     View::share('site_title', \Config::get('app.site_title'));
     View::share('title', ucwords($this->currentAction));
     View::share('alerts', \Session::get('alerts', array()));
     View::share('menu', $this->getMenu());
     View::share('logged_in', \Auth::check());
     $this->user = \Auth::check() ? \Auth::user() : new \Ormic\Model\User();
     View::share('user', $this->user);
     // Standard views are at:
     // resources/views/<controller_name>/<action_name>.blade.php
     $this->view = $this->getView();
     if (getenv('APP_ENV') == 'local') {
         $this->queryListener();
     }
 }
Esempio n. 17
0
 function active($link, $parameters = [], $active = 'active', $inactive = null)
 {
     $link = strtolower($link);
     $routeAction = strtolower(Route::currentRouteAction());
     $routeName = strtolower(Route::currentRouteName());
     $controller = explode('@', $routeAction)[0];
     $currentParameters = Route::current()->parameters();
     $matches = array($routeAction, $controller);
     if ($routeName) {
         $matches[] = $routeName;
         $matches = array_merge($matches, explode('.', $routeName));
     }
     $match = in_array($link, $matches);
     foreach ($parameters as $parameter) {
         $match = $match && in_array($parameter, $currentParameters);
     }
     return $match ? $active : $inactive;
 }
Esempio n. 18
0
 /**
  * Constructor
  *
  * Here, we do two things :
  *
  *   1. Check for ACL annotations
  *
  *   2. Automatically assign corresponding layout.
  *      Prototype : 
  *         a. General action
  *            HomeController@actionIndex    => ./views/home/index.blade.php
  *            AuthController@actionRegister => ./views/auth/register.blade.php
  *            ... and so on.
  *         b. Action with sub-view 
  *            AdminController@actionFooBar     => ./views/admin/foo/bar.blade.php
  *            AdminController@actionLoremIpsum => ./views/admin/lorem/ipsum.blade.php
  *            ... and so on.
  *
  */
 public function __construct()
 {
     $response = Acl::checkRuleFromControllerAnnotation(Route::currentRouteAction(), Session::get('roles'));
     if ($response instanceof Response) {
         $this->earlyResponse = $response;
     }
     list($module, $action) = explode('@', str_replace(array('Controller', 'action', 'get', 'post'), '', Route::currentRouteAction()));
     // Map-out necessary view
     $view = strtolower($action);
     for ($i = 1; $i < strlen($action); $i++) {
         if (ctype_upper($action[$i])) {
             $view = strtolower(substr($action, 0, 5));
             $view .= '.' . strtolower(substr($action, 5));
             break;
         }
     }
     $this->layout = strtolower($module) . '.' . $view;
 }
Esempio n. 19
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     //检测是否登录,未登录跳转,登录了赋予菜单
     if (\Session::has('adminlogin')) {
         if (!env('PERMISSION_USE_CACHE', 'true')) {
             $uinfo = \Pianke\Models\AdminUser::find(\Session::get('adminlogin')->id);
             \Session::put('adminlogin', $uinfo);
             \Pianke\Models\AdminPermission::getCurPermissionArray(explode("|", $uinfo->role->permissions));
         }
         view()->share('menu', \Session::get('menu'));
     } else {
         return redirect()->action('\\Pianke\\Http\\Controllers\\AdminLoginController@getLogin');
     }
     //检测是否有权限访问操作
     if (!in_array('\\' . \Route::currentRouteAction(), \Session::get('curpermissions'))) {
         return redirect()->back()->withNotice(['type' => 'error', 'msg' => trans('admin.nopermission'), 'title' => trans('admin.permissionerror')]);
     }
     return $next($request);
 }
Esempio n. 20
0
 public function __construct()
 {
     $this->beforeFilter(function () {
         if (Auth::guest()) {
             return Redirect::to('admin/login');
         } else {
             $user = User::find(Auth::user()->id);
             if (!$user->hasRole("Admin")) {
                 Auth::logout();
                 return Redirect::to('admin/login');
             }
         }
     }, ['except' => ['login', 'postLogin']]);
     $partAction = explode('@', Route::currentRouteAction());
     $partRoute = explode('/', Request::path());
     $this->action = isset($partAction[1]) ? $partAction[1] : '';
     $this->name = isset($partRoute[1]) ? $partRoute[1] : '';
     $this->table = $this->name . 's';
 }
Esempio n. 21
0
 public function priviledge_user()
 {
     if (\Auth::check()) {
         $user = \Auth::user();
         $data = array();
         $routes = explode("\\", \Route::currentRouteAction());
         $route = explode("@", $routes[count($routes) - 1]);
         if (!empty($route[0])) {
             $data['module_name'] = strtolower(str_replace("Controller", "", $route[0]));
         }
         if (!empty($route[1])) {
             $data['action_name'] = strtolower($route[1]);
         }
         if (empty($route[1]) || empty($route[0])) {
             $route_1 = \Request::segment(1);
             if (!empty($route_1)) {
                 $data['module_name'] = strtolower($route_1);
             }
             $route_2 = \Request::segment(2);
             $data['action_name'] = 'index';
             if (!empty($route_2)) {
                 $data['action_name'] = strtolower($route_2);
             }
         }
         $data['role_id'] = $user->role_id;
         if (!empty($data) && count($data) == 3) {
             $priv = \DB::select('SELECT p_r.priviledge_id
                             FROM priviledge_role p_r
                             INNER JOIN priviledges pr ON p_r.priviledge_id = pr.id
                             WHERE p_r.role_id = :role_id
                             AND pr.module = :module_name
                             AND pr.action = :action_name', $data);
             if (count($priv) > 0) {
                 return true;
             }
         }
         return \Redirect::to('dashboard')->send();
     }
 }
Esempio n. 22
0
function getUriByController()
{
    $routes = [];
    $action = Route::currentRouteAction();
    $controller = substr($action, strrpos($action, '\\') + 1);
    $controller = explode('@', $controller);
    $controller = $controller[0];
    foreach (Route::getRoutes()->getRoutes() as $route) {
        $curr_action = $route->getAction();
        if (array_key_exists('controller', $curr_action)) {
            // You can also use explode('@', $action['controller']); here
            // to separate the class name from the method
            $curr_action = $curr_action['controller'];
            $action_controller = explode('@', substr($curr_action, strrpos($curr_action, '\\') + 1));
            $action_controller = $action_controller[0];
            $entidad = "";
            if ($controller == $action_controller) {
                $name = explode('.', $route->getName());
                $last_name = '';
                $item_type = '';
                if (count($name) > 1) {
                    $last_name = count($name) - 1;
                    $item_type = $name[1];
                }
                $uri = preg_replace("/{[a-z]*}/", "#", $route->getUri());
                //dd($uri,$route->getMethods()[0],$route->getName(),$name[$last_name]);
                //var_dump( "name",$name,"last_name",$last_name );
                $routes[$name[$last_name]] = ["uri" => $uri, "method" => $route->getMethods()[0], "name" => $route->getName()];
                if ($entidad == "") {
                    $entidad = $name[1];
                    $routes["entidad"] = $entidad;
                }
                //dd("first",$routes);
            }
        }
    }
    return $routes;
}
Esempio n. 23
0
            <span class="navbar-brand">Laravel RBAC</span>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="laravel-rbac-nav">
            <ul class="nav navbar-nav">
                <li class="<?php 
echo strpos(Route::currentRouteAction(), Config::get('laravel-rbac.roleController')) !== false ? 'active' : '';
?>
">
                    <a href="{{ \URL::action('\\' . \Config::get('laravel-rbac.roleController') . '@index') }}">
                        @lang('aliukevicius/laravelRbac::lang.role.indexPageTitle')
                    </a>
                </li>
                <li class="<?php 
echo strpos(Route::currentRouteAction(), Config::get('laravel-rbac.permissionController')) !== false ? 'active' : '';
?>
">
                    <a href="{{ \URL::action('\\' . \Config::get('laravel-rbac.permissionController') . '@index') }}">
                        @lang('aliukevicius/laravelRbac::lang.permissions.indexPageTitle')
                    </a>
                </li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>

<div class="container">
    @include('aliukevicius/laravelRbac::_partials.messages')
    @yield('content')
</div>
Esempio n. 24
0
 protected function getControllerNameForAction()
 {
     $action = explode('@', \Route::currentRouteAction());
     return '\\' . $action[0];
 }
Esempio n. 25
0
function current_action()
{
    $currentAction = \Route::currentRouteAction();
    if ($currentAction !== null) {
        return explode("@", $currentAction, 2)[1];
    }
}
Esempio n. 26
0
        <meta property="og:site_name" content=""/>
        <meta property="og:url" content="" />
        <meta property="og:description" content="" />
        <meta property="og:image" content="" />
        <!-- facebook meta -->

        <link rel="stylesheet" href="{{ URL::to('/') . elixir('css/app.css') }}">

        <link href="http://fonts.googleapis.com/css?family=Ubuntu:300,400,700|Raleway:200" rel="stylesheet" type="text/css">
    </head>
    <?php 
list(, $action) = explode('@', Route::getCurrentRoute()->getActionName());
?>

    <?php 
$currentAction = \Route::currentRouteAction();
list($controller, $method) = explode('@', $currentAction);
$controller = preg_replace('/.*\\\\/', '', $controller);
?>

    <body class="page-{{$action}}" id="{{ str_slug($controller) . '-' . $action }}" data-controller="{{ str_slug($controller) }}" data-action="{{ $action }}" data-root-url="{{ URL::to('/') }}">
        <!--[if lt IE 7]>
            <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
        <![endif]-->

        @yield('content')

        <script src="{{ URL::to('/') . elixir('js/all.js') }}"></script>

        <script>
            //colocar aqui o ID do analytics
Esempio n. 27
0
 /**
  * return all scripts for btn count
  *
  * @return Array
  */
 private function getCounts()
 {
     return array('environment' => function () {
         return \App::environment();
     }, 'memory' => function () {
         return Profiler::getMemoryUsage();
     }, 'controller' => function () {
         return 2;
         global $app;
         if (strpos($app::VERSION, '4.1') !== FALSE) {
             return $controller = \Route::current()->getActionName() != "" ? \Route::current()->getActionName() : "N/A";
         } elseif (strpos($app::VERSION, '4.0') !== FALSE) {
             return $controller = \Route::currentRouteAction() != "" ? \Route::currentRouteAction() : "N/A";
         }
     }, 'routes' => function () {
         return count(\Route::getRoutes());
     }, 'log' => function ($app_logs) {
         return count($app_logs);
     }, 'sql' => function ($sql_log) {
         return count($sql_log);
     }, 'checkpoints' => function ($times) {
         return round($times['total'], 3);
     }, 'file' => function ($includedFiles) {
         return count($includedFiles);
     }, 'view' => function ($view_data) {
         return count($view_data);
     }, 'session' => function () {
         return count(array_merge(\Session::all(), ['']));
     }, 'input' => function () {
         return count(array_merge($_POST, $_GET));
     }, 'server' => function () {
         return count($_SERVER);
     }, 'storage' => function ($storageLogs) {
         return count($storageLogs);
     }, 'config' => function ($config) {
         return count($config);
     }, 'auth' => function () {
         return \Auth::user()->email ? \Auth::user()->email : 'User';
     }, 'auth-sentry' => function () {
         return \Sentry::getUser()->email ? \Sentry::getUser()->email : 'User';
     });
 }
Esempio n. 28
0
function controllerName()
{
    $controller = substr(strtolower(strrchr(Route::currentRouteAction(), '\\')), 1);
    preg_match('/(.*?)controller/', $controller, $match);
    return $match[1];
}
Esempio n. 29
0
@section('admin_nav')
<?php 
$controller = explode("@", Route::currentRouteAction());
$controller = $controller[0];
?>
    <!-- Fixed navbar -->
    <nav class="navbar navbar-default navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#"><font color="#ff4500" size="12"><strong>Tingaso</strong></font></a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
          <ul class="nav navbar-nav">
            <li @if ($controller == "HomeController") class="active" @endif><a href="/home">Home</a></li>
            <li @if ($controller == "DialerController") class="active" @endif><a href="/dialer">Dialer</a></li>
            <li @if ($controller == "ReportsController") class="active" @endif><a href="/reports">Reports</a></li>
          </ul>
          <ul class="nav navbar-nav navbar-right">
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Settings <span class="caret"></span></a>
              <ul class="dropdown-menu" role="menu">
                <li><a href="#">Users</a></li>
                <li class="divider"></li>
                <li><a href="/settings/dialer">Dialers</a></li>
                <li><a href="/settings/asterisk">Asterisk Settings</a></li>
<?php

$curRoute = Route::currentRouteAction();
$controller = '';
$action = '';
if ($curRoute != '') {
    if (strpos($curRoute, '@')) {
        $routePartArr = explode('@', $curRoute);
        if (isset($routePartArr) && is_array($routePartArr) && count($routePartArr) > 0) {
            if (isset($routePartArr[0])) {
                $controller = $routePartArr[0];
            }
            if (isset($routePartArr[1])) {
                $action = $routePartArr[1];
            }
        }
    }
}
$activeCls = 'active';
?>
<!-- Begin Navbar -->
<div id="nav">
    <div class="navbar navbar-default navbar-static animatedParent animateOnce">
		<div class="container animated fadeInDownShort">
			<!-- Brand and toggle get grouped for better mobile display -->
			<div class="navbar-header">
				<a class="navbar-brand" href="<% URL::to('/'); %>"><!-- <img alt="Logo" src="images/logo.png" class="img-responsive"> --><span>In</span>zaana</a>
				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
					<span class="sr-only">Toggle navigation</span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>