Пример #1
0
 /**
  * @return \Illuminate\View\View
  */
 public function index()
 {
     //        //TODO: Warn of any routes in our DB that is not used in the app.
     $page_title = trans('admin/routes/general.page.index.title');
     $page_description = trans('admin/routes/general.page.index.description');
     $routes = $this->route->pushCriteria(new RoutesWithPermissions())->pushCriteria(new RoutesByPathAscending())->pushCriteria(new RoutesByMethodAscending())->paginate(20);
     $perms = $this->permission->all()->lists('display_name', 'id');
     $perms = $perms->toArray(0);
     array_unshift($perms, '');
     return view('admin.routes.index', compact('routes', 'perms', 'page_title', 'page_description'));
 }
 /**
  * @param Request $request
  * @return array|static[]
  */
 public function searchByName(Request $request)
 {
     $return_arr = null;
     $query = $request->input('query');
     $routes = $this->route->pushCriteria(new RoutesWhereNameOrPathOrActionNameLike($query))->all();
     foreach ($routes as $route) {
         $id = $route->id;
         $method = $route->method;
         $path = $route->path;
         $name = $route->name;
         $action_name = $route->action_name;
         $entry_arr = ['id' => $id, 'text' => "{$method} {$path} ({$name}) [{$action_name}]"];
         $return_arr[] = $entry_arr;
     }
     return $return_arr;
 }