本文整理汇总了PHP中Route::getCurrentRoute方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::getCurrentRoute方法的具体用法?PHP Route::getCurrentRoute怎么用?PHP Route::getCurrentRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Route
的用法示例。
在下文中一共展示了Route::getCurrentRoute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin_header_active
/**
*
*/
function admin_header_active($name)
{
if (Route::getCurrentRoute()->getName() == $name) {
return 'active';
}
return '';
}
示例2: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!$this->modelAdmin->find(\Route::getCurrentRoute()->getParameter('one'))) {
return Response::view('flare::admin.404', [], 404);
}
return $next($request);
}
示例3: setUp
protected function setUp()
{
$this->current_route = Route::getCurrentRoute()->getName();
$this->logged_user = Sentry::getUser();
View::share('logged_user', $this->logged_user);
View::share('current_route', $this->current_route);
}
示例4: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$route = Route::getCurrentRoute()->getPath();
if ('/admin/disciplinas' == $route) {
$conteudoDisciplinas = new Disciplinas();
/*$id = Input::get('id');
if($id>0){
$conteudoDisciplinas = Disciplinas::find($id);
}*/
$conteudoDisciplinas->nome_dis = Request::get('nomeDisciplina');
$conteudoDisciplinas->codigo_dis = Request::get('codigoDisciplina');
$conteudoDisciplinas->periodo_dis = Request::get('periodoDisciplina');
$conteudoDisciplinas->save();
$value = array('success' => true);
// return json_encode($value);
return Redirect::to('/admin/disciplinas');
}
if ('/admin/professores' == $route) {
return 'oi';
}
/*switch($route){
case '/admin/disciplinas/add':
$queryBuilder = 'Disciplinas';
break;
default:
break;
}
$updater = new $queryBuilder();*/
}
示例5: routeActive
function routeActive($route, $children = [], $simple = false)
{
$found = false;
$currentRoute = Route::getCurrentRoute()->getName();
if ($children instanceof Illuminate\Support\Collection) {
$children = $children->toArray();
}
if ($route == $currentRoute || in_array($currentRoute, $children)) {
$found = true;
} elseif (substr($route, -1) == '*' && checkPartialRoute($route, $currentRoute) == true) {
$found = true;
} else {
foreach ($children as $child) {
if (checkPartialRoute($child, $currentRoute) == true) {
$found = true;
break;
}
}
}
if ($found == true) {
if ($simple) {
return 'active';
} else {
return "class='active'";
}
}
}
示例6: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
/*
* return paginated results to do infinite scroll, maybe?
*/
$works = Work::with(['photos' => function ($photos) {
/*
* Return only the selected columns
*
* Includes the foreign key to the field list,
* or else Laravel won't be able to link the
* models together
*/
$photos->addSelect(['id', 'filename', 'work_id']);
}, 'agency' => function ($agencies) {
/*
* Return only the selected columns
*
* No need to include foreing key here since
* Work "belongsTo" an agency
*/
$agencies->addSelect(['id', 'name']);
// @TODO ✅ Lower this pagination?
}])->latest()->published()->orderBy('featured', 'desc')->paginate(50);
/*
* If we are in the admin panel, render a view
* otherwise return as json
*/
$routeName = \Route::getCurrentRoute()->getName();
return $routeName == 'dash.works' ? view('dashboard.works.index', compact('works')) : $works;
}
示例7: __construct
public function __construct()
{
if (\App::runningInConsole()) {
$this->request = [];
} else {
$this->request = ['url' => request()->url(), 'method' => request()->method(), 'input' => request()->input(), 'action' => \Route::getCurrentRoute() !== null ? \Route::getCurrentRoute()->getAction() : null, 'headers' => request()->header()];
}
}
示例8: getActive
function getActive($id)
{
$currentRoute = Route::getCurrentRoute()->getParameter('category_id');
if ($id == $currentRoute) {
return 'active';
}
return '';
}
示例9: _headerTitle
/**
* 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;
}
示例10: getActiveLink
function getActiveLink($name)
{
$current = Route::getCurrentRoute()->getPath();
if ($name == $current) {
echo 'active';
}
echo '';
}
示例11: getIndex
public function getIndex()
{
$id = Sentry::getUser()->id;
$hoy = date('Y-m-d');
$ruta = \Route::getCurrentRoute();
$data['url'] = url($ruta->getPath());
$data['bitacoras'] = Bitacora::where('usuario_id', '=', $id)->where('ind_atendida', '=', 'false')->where('ind_alarma', '=', 'true')->where('fecha', '<=', $hoy)->get();
return View::make('solicitudes.alertas', $data);
}
示例12: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
/*
* Return paginated results, I might not need this route...
*/
$photos = Photo::latest()->paginate(25);
$routeName = \Route::getCurrentRoute()->getName();
return $routeName == 'dash.photos' ? view('dashboard.photos.index', compact('photos')) : $photos;
}
示例13: after
public function after()
{
if (strlen($this->response) > 0) {
echo $this->response;
} else {
$currentRoute = Route::getCurrentRoute();
echo $this->view->render($currentRoute[1][0] . '/' . $currentRoute[1][1]);
}
}
示例14: link_to_sorting_action
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' ? '↑' : '↓' : 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);
}
示例15: isSelected
/**
*
* @return boolean Пункт меню выбран
*/
public function isSelected()
{
// Разбираем запрос, ищем текущий элемент меню.
$pageAction = Route::getCurrentRoute()->action;
foreach ($this->actions as $action) {
if ($pageAction == $action) {
return true;
}
}
return false;
}