currentRouteName() public static method

Get the current route name.
public static currentRouteName ( ) : string | null
return string | null
 public function harian()
 {
     $bil = 1;
     $laporans = Laporan::latest('tarikh')->assigned()->today()->get();
     \Session::put('lastReport', \Route::currentRouteName());
     return View('members.technician.harian', compact('bil', 'laporans'));
 }
Example #2
0
 static function factory($name = null)
 {
     if (!$name) {
         $name = \Route::currentRouteName();
     }
     return parent::factory($name);
 }
Example #3
0
 public function __construct()
 {
     $this->veer = app('veer');
     $this->veer->routePrepare(\Route::currentRouteName());
     $this->template = $this->veer->template;
     $this->middleware('early.view');
 }
 /**
  * @return string
  */
 protected function getType()
 {
     if ($this->type) {
         return $this->type;
     }
     return Str::startsWith(\Route::currentRouteName(), 'admin.plugins') ? self::TYPE_PLUGINS : self::TYPE_WIDGETS;
 }
Example #5
0
/**
 * render_navigation()
 */
function render_navigation($depth = -1, $tree = NULL, &$html = '', $level = 0, $preroute = '')
{
    $html .= $level > 0 ? '<ul class="sub l' . $level . '">' : '<ul>';
    if (is_null($tree)) {
        $tree = Lang::get('routes');
    }
    foreach ($tree as $route => $item) {
        if (isset($item['nav']) && $item['nav'] != NULL) {
            $active = $route == Route::currentRouteName();
            if ($route == 'news' && substr(Route::currentRouteName(), 0, 5) == 'news.') {
                $active = true;
            }
            $html .= '<li>';
            $html .= '<a href="' . route($route) . ($route == 'home' ? '/' : '') . '"' . ($active ? ' class="active"' : '') . '>' . $item['nav'] . '</a>';
            if (isset($item['sub']) && is_array($item['sub'])) {
                if ($depth == -1 || $level < $depth) {
                    render_navigation($depth, $item['sub'], $html, $level + 1, $preroute . $route . '.sub.');
                }
            }
            $html .= '</li>';
        }
    }
    $html .= '</ul>';
    return $html;
}
Example #6
0
 /**
  * Share common view variables
  */
 protected function setSharedVariables()
 {
     view()->share('currentLocale', app()->getLocale());
     view()->share('currentUser', auth()->user());
     view()->share('currentRouteName', \Route::currentRouteName());
     view()->share('currentUrl', \Request::fullUrl());
 }
Example #7
0
function isActiveRoute($route, $output = "active")
{
    if (Route::currentRouteName() == $route) {
        return $output;
    }
    return '';
}
Example #8
0
 /**
  * Check weather or not the step is complete
  *
  * @param $step
  * @return null|string
  */
 function is_done($step)
 {
     $steps = steps();
     $step = array_search($step, $steps);
     $current_step = array_search(Route::currentRouteName(), $steps);
     return $current_step > $step ? 'done' : NULL;
 }
Example #9
0
 /**
  * @param $tpl
  *
  * @return $this
  */
 function layout($tpl = null)
 {
     //        $template = explode('::', $as);
     //        if (count($template) > 1) {
     //            $namespace = Arr::get($template, 0);
     //            if (substr_count($namespace, '-') && substr_count(Arr::get($template, 1), '.')) {
     //                $package   = explode('.', Arr::get($template, 1), 3);
     //                $end       = Arr::get($package, 2, "");
     //                if ($end) {
     //                    $end = '.' . $end;
     //                }
     //                $package = Arr::get($package, 1) . '.' . Arr::get($package, 0) . $end;
     //
     //                $as = $namespace . '::' . trim($package, '.');
     //                dd($as );
     //            }
     //        }
     if (true === $tpl) {
         $this->layout = \Route::currentRouteName();
     } elseif (null !== $tpl) {
         $this->layout = $tpl;
     }
     //        dd($this->layout);
     return $this;
 }
Example #10
0
 public function index()
 {
     $bil = 1;
     $laporans = Laporan::where('user', \Auth::user()->username)->where('status', 0)->get();
     \Session::put('lastReport', \Route::currentRouteName());
     return View('members.technician.laporan.cetak.index', compact('bil', 'laporans'));
 }
 /**
  * @param RoleRepositoryInterface $repository
  * @param RoleDataTable $dataTableConfig
  * @param UserDataTable $userDataTableConfig
  */
 public function __construct(RoleRepositoryInterface $repository, RoleDataTable $dataTableConfig, UserDataTable $userDataTableConfig)
 {
     $this->repository = $repository;
     $this->dataTableConfig = $dataTableConfig;
     $this->userDataTableConfig = $userDataTableConfig;
     $this->breadcrumbConfig = BreadcrumbConfigFactory::create(Route::currentRouteName(), ['role.store', 'role.update', 'role.destroy', 'role.destroy.multiple']);
 }
Example #12
0
 /**
  * Creates the view object for the HTML client.
  *
  * @param \MW_Config_Interface $config Configuration object
  * @param array $templatePaths List of base path names with relative template paths as key/value pairs
  * @param string|null $locale Code of the current language or null for no translation
  * @return \MW_View_Interface View object
  */
 public function create(\MW_Config_Interface $config, array $templatePaths, $locale = null)
 {
     $params = $fixed = array();
     if ($locale !== null) {
         $params = \Route::current()->parameters() + \Input::all();
         $params['target'] = \Route::currentRouteName();
         $fixed = $this->getFixedParams();
         $i18n = app('\\Aimeos\\Shop\\Base\\I18n')->get(array($locale));
         $translation = $i18n[$locale];
     } else {
         $translation = new \MW_Translation_None('en');
     }
     $view = new \MW_View_Default();
     $helper = new \MW_View_Helper_Translate_Default($view, $translation);
     $view->addHelper('translate', $helper);
     $helper = new \MW_View_Helper_Url_Laravel5($view, app('url'), $fixed);
     $view->addHelper('url', $helper);
     $helper = new \MW_View_Helper_Partial_Default($view, $config, $templatePaths);
     $view->addHelper('partial', $helper);
     $helper = new \MW_View_Helper_Parameter_Default($view, $params);
     $view->addHelper('param', $helper);
     $helper = new \MW_View_Helper_Config_Default($view, $config);
     $view->addHelper('config', $helper);
     $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.');
     $sep1000 = $config->get('client/html/common/format/seperator1000', ' ');
     $helper = new \MW_View_Helper_Number_Default($view, $sepDec, $sep1000);
     $view->addHelper('number', $helper);
     $helper = new \MW_View_Helper_FormParam_Default($view, array());
     $view->addHelper('formparam', $helper);
     $helper = new \MW_View_Helper_Encoder_Default($view);
     $view->addHelper('encoder', $helper);
     $helper = new \MW_View_Helper_Csrf_Default($view, '_token', csrf_token());
     $view->addHelper('csrf', $helper);
     return $view;
 }
Example #13
0
/**
 * Set active acording to the route
 *
 * @param $name
 * @return string
 */
function setActive($name)
{
    if (\Route::currentRouteName() == $name) {
        return 'class="active"';
    }
    return '';
}
 public function __construct()
 {
     parent::__construct(pathinfo(dirname(__DIR__), PATHINFO_BASENAME));
     if (Route::currentRouteName() != "ToolAdvertiserManagerPreview") {
         $this->loadLeftMenu('menu.tool');
     }
 }
Example #15
0
 protected function routeHandler()
 {
     $route_name = \Route::currentRouteName();
     if (empty($route_name)) {
         return false;
     }
     return str_replace('.', '_', strtolower($route_name));
 }
Example #16
0
 /**
  * Share common view variables
  */
 protected function setSharedVariables()
 {
     view()->share('currentLocale', app()->getLocale());
     view()->share('currentUser', auth()->user());
     view()->share('currentRouteName', \Route::currentRouteName());
     view()->share('currentUrl', current_url());
     view()->share('isLandingPage', in_array(\Route::currentRouteName(), ['home', 'index']));
 }
Example #17
0
 public function __construct()
 {
     $this->category = db_parameter('CATEGORY_HOME');
     $this->itemsPerPage = db_parameter('CORNERS_HOME_ITEMS_NUMBER', $this->itemsPerPage);
     if (starts_with(\Route::currentRouteName(), "index")) {
         $this->createListOfPages();
     }
 }
Example #18
0
 /**
  * Return the header title for each page
  *
  * @return string
  */
 function _headerTitle()
 {
     $route = Route::currentRouteName();
     $title = '<h1 class="page-heading">';
     $title .= trans(Route::getCurrentRoute()->getName());
     $title .= '</h1>';
     return $title;
 }
Example #19
0
/**
 * Description of helpers
 *
 * @author Syiewa
 */
function setActive($route, $class = 'active')
{
    $exp = explode('.', $route);
    $array = array_splice($exp, 0, 2);
    $expRoute = explode('.', Route::currentRouteName());
    $arrayRoute = array_splice($expRoute, 0, 2);
    $diff = array_diff($array, $arrayRoute);
    return count($diff) == 0 ? $class : '';
}
Example #20
0
File: Map.php Project: larakit/lk
 function getCurrent()
 {
     $access_name = \Route::currentRouteName();
     $params = \Route::current()->parameters();
     if ($params) {
         $access_name .= '.' . str_replace(['&', '='], ['.', '-'], http_build_query($params));
     }
     return Arr::get($this->map, $access_name);
 }
Example #21
0
 protected function pass($request)
 {
     $routeName = \Route::currentRouteName();
     $method = $request->method();
     if (\Auth::guest()) {
         return false;
     }
     $check = new AclAuthCheck(\Auth::id());
     return $check->canAccessRoute($routeName, $method);
 }
 protected function bootBaseData()
 {
     if (\Auth::check()) {
         $groups = Group::enable()->orderBy('created_at', 'desc')->get();
     } else {
         $groups = [];
     }
     view()->share('enableGroups', $groups);
     view()->share('currentRouteName', \Route::currentRouteName());
 }
 public static function link_to_sorting_action($col, $title = null)
 {
     if (is_null($title)) {
         $title = str_replace('_', ' ', $col);
         $title = ucfirst($title);
     }
     $indicator = Input::get('s') == $col ? Input::get('o') === 'asc' ? '&uarr;' : '&darr;' : null;
     $parameters = array_merge(Route::getCurrentRoute()->parameters(), array('s' => $col, 'o' => Input::get('o') === 'asc' ? 'desc' : 'asc'));
     return link_to_route(Route::currentRouteName(), "{$title} {$indicator}", $parameters);
 }
 /**
  * @return void
  */
 protected function setupPage()
 {
     $page = new PageRepo();
     $type = \Auth::check() ? 'private' : 'public';
     $page = $page->getByRouteName(Route::currentRouteName(), $type);
     if (is_object($page)) {
         $this->addParam('page', $page);
     }
     unset($page);
 }
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     $router->bind('articles', function ($id) {
         return \Route::currentRouteName() == "articles.edit" ? \App\Article::findOrFail($id) : \App\Article::published()->findOrFail($id);
     });
     $router->bind('tags', function ($name) {
         return \App\Tag::where('name', $name)->firstOrFail();
     });
 }
Example #26
0
 function url_locale($code)
 {
     $route = Route::currentRouteName();
     // if locale not set concanate code to route name
     if (!app('l5-localization')->has()) {
         return app('url')->route("{$code}.{$route}");
     }
     // else replace the locale code in route name
     return app('url')->route(substr_replace($route, $code, 0, strpos($route, '.')));
 }
Example #27
0
 /**
  * Set the active class to the current opened menu.
  *
  * @param  string|array $route
  * @param  string       $className
  * @return string
  */
 function isActive($route, $className = 'active')
 {
     if (is_array($route)) {
         return in_array(Route::currentRouteName(), $route) ? $className : '';
     }
     if (Route::currentRouteName() == $route) {
         return $className;
     }
     if (strpos(URL::current(), $route)) {
         return $className;
     }
 }
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules(\Illuminate\Http\Request $req)
 {
     $passwordRule = 'required|confirmed';
     if (\Route::currentRouteName() == "users.panelists.update" && (int) $req->input("password") == 0) {
         $passwordRule = "";
     }
     $email = "required|email|unique:users";
     if (\Route::currentRouteName() == "users.panelists.update") {
         $panelist = Panelist::findOrFail($this->route('panelists'));
         $email = "required|email|unique:users,email," . $panelist->user_id;
     }
     return ['name' => 'required', 'email' => $email, 'password' => $passwordRule];
 }
Example #29
0
 public function checkAuths()
 {
     $nowAccess = \Route::currentRouteName();
     $authAllows = session('authAllows');
     print_r($authAllows);
     //默认应当允许的访问权限
     $authAllows[] = '';
     if (in_array($nowAccess, $authAllows)) {
         return true;
     } else {
         return false;
     }
 }
Example #30
0
function areActiveRoutes(array $routes, $output = "active")
{
    foreach ($routes as $route) {
        $currentRouteName = Route::currentRouteName();
        if (strpos($route, ".") != true) {
            $split = explode('.', $currentRouteName);
            $currentRouteName = $split[0];
        }
        if ($currentRouteName == $route) {
            return $output;
        }
    }
}