Example #1
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $rules = $this->createRequest->rules();
     $rules['username'] .= ',username,' . $this->route->getParameter('users') . ',id';
     $rules['password'] = '******';
     return $rules;
 }
Example #2
0
 /**
  * Validates show path.
  * @param Route $route
  * @return Response
  */
 public function validateShowPath(Route $route)
 {
     $org = $route->getParameter('organisations');
     $attr = $route->getParameter('attrs');
     if ($attr->organisation_id !== $org->id) {
         return Response::json(null, 404);
     }
 }
 public function find(Route $route)
 {
     if ($route->getParameter('inventario')) {
         $codigo = $route->getParameter('inventario');
     } else {
         $codigo = $route->getParameter('id');
     }
     $this->datos = Inventario::find($codigo);
     $this->notFound($this->datos);
 }
Example #4
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $id = $this->route->getParameter('tenderos');
     if (is_null($id)) {
         $id = $this->route->getParameter('productores');
     }
     $rules = $this->createRequest->rules();
     $rules['username'] .= ',username,' . $id . ',id';
     $rules['doc'] .= ',doc,' . $id . ',id';
     $rules['email'] .= ',email,' . $id . ',id';
     $rules['password'] = '******';
     $rules['terms'] = '';
     return $rules;
 }
 public function find(Route $route)
 {
     $manuales = manuales::find($route->getParameter('manuales'));
     if (!$manuales) {
         abort(404);
     }
 }
 /**
  * Find the Checklist or App Abort 404.
  */
 public function findChecklist(Route $route)
 {
     $this->checklist = Checklist::findOrFail($route->getParameter('doit'));
     $this->checklist->load('answers.question');
     $this->checklist->answers = $this->checklist->answers->sortBy(function ($answer, $key) {
         return $answer->question->order;
     });
 }
 /**
  * Find the ObservationFormatUser or App Abort 404.
  */
 public function findObservationFormatUser(Route $route)
 {
     $this->observation = ObservationFormatUser::findOrFail($route->getParameter('doit'));
     $this->observation->load('answers.question');
     $this->observation->answers = $this->observation->answers->sortBy(function ($answer, $key) {
         return $answer->question->order;
     });
 }
Example #8
0
 public function findWithTrashed(Route $route)
 {
     $id = $route->getParameter('id');
     $this->resource = $this->repository->findWithTrashed($id);
     if (!$this->resource) {
         if (Request::ajax()) {
             return response()->json([], 404);
         }
         throw new NotFoundHttpException();
     }
 }
Example #9
0
 /**
  * @param Route $route
  */
 public function detectLocale(Route $route)
 {
     $locale = $route->getParameter('locale');
     if (sizeof(Lang::where('iso', $locale)->get()) != 0) {
         app()->setLocale($locale);
         Carbon::setLocale($locale);
     } else {
         app()->setLocale('pt');
         Carbon::setLocale('pt');
     }
     $route->forgetParameter('locale');
 }
Example #10
0
 public function showCollection(Route $route, Router $router)
 {
     // We extract the params not set in the query from the URL
     $queryParams = $route->parameters();
     // Figure out the page from the route URL parameters
     $page = max(1, $route->getParameter('page'));
     $routeParams = $route->getAction();
     $query = $routeParams['query'];
     $articles = PressFacade::query($query, $queryParams);
     if (0 === $articles->count() && $page !== 1) {
         return abort(404);
     }
     // create a paginator if required
     if ($routeParams['paginate']) {
         $page_size = PressFacade::getConf('default_page_size');
         $paginator = $articles->getPaginator($page_size);
         $articles = $articles->forPage($page, $page_size);
     } else {
         $paginator = $articles->getPaginator(999999);
     }
     // decide the view. If it is provided with the query options, just use
     // it. if it is provided with a theme wildcard, use the default theme
     // else try to find a 'collection' view in the default theme.
     // Also, the user can set a theme to load the assets from.
     $theme = array_get($routeParams, 'theme', PressFacade::getConf('theme'));
     if (isset($routeParams['view'])) {
         $viewName = str_replace('_::', "{$theme}::", $routeParams['view']);
         $view = View::make($viewName);
     } else {
         $view = View::make("{$theme}::collection");
     }
     // paginator base path
     $baseUrlParamNames = $this->getRouteParamNames($routeParams['base_route'], $router);
     $baseUrlParams = array_only($queryParams, $baseUrlParamNames);
     $basePath = \URL::route($routeParams['base_route'], $baseUrlParams);
     $paginator->setBasePath($basePath);
     // metadata from the page can be defined trough the route
     $meta = (object) array_get($routeParams, 'meta', []);
     return $view->with('meta', SEO::getMeta())->with('articles', $articles)->with('cacheInfo', PressFacade::editingCacheInfo())->with('themeAssets', PressFacade::getThemeAssets($theme))->with('paginator', $paginator);
 }
Example #11
0
 public function find(Route $route)
 {
     $this->blog = Blog::find($route->getParameter('blog'));
 }
Example #12
0
 /**
  * Find the Protocol or App Abort 404.
  */
 public function findProtocol(Route $route)
 {
     $this->protocol = Protocol::findOrFail($route->getParameter('protocols'));
 }
Example #13
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     return ['name' => 'required', 'username' => 'required', 'email' => 'required|unique:users,email,' . $this->route->getParameter('users'), 'password' => '', 'type' => 'required|in:user,admin,editor,visit'];
 }
Example #14
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     return ['identification' => 'required|unique:users,identification,' . $this->route->getParameter('users'), 'first_name' => 'required', 'last_name' => 'required', 'type' => 'required', 'email' => 'required|unique:users,email,' . $this->route->getParameter('users'), 'password' => 'required'];
 }
Example #15
0
 /**
  * Get the slug of the trick being edited / deleted.
  *
  * @param \Illuminate\Routing\Route $route
  *
  * @return string
  */
 protected function getSlug($route)
 {
     return $route->getParameter('trick_slug');
 }
 public function find(Route $route)
 {
     //funcion para buscar
     $this->destete = Destete::find($route->getParameter('destete'));
 }
 public function find(Route $route)
 {
     $this->producto = Producto::find($route->getParameter('productos'));
     // productos es el atributo que figura junto al nombre de la ruta en el archivo de rutas.
 }
Example #18
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     return ['nombre_lista' => 'required|unique:lista_chequeo,nom_lista,' . $this->route->getParameter('lista'), 'tipo' => 'exists:tipo,id', 'sector' => 'exists:sector_inversion,id', 'etapa' => 'exists:etapa_lista,id', 'proceso' => 'exists:proceso,id'];
 }
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     return ['reference' => 'required|min:3|unique:cabinets,reference,' . $this->route->getParameter('cabinets'), 'description' => 'min:10', 'street' => 'required|min:5', 'croos' => 'required|min:5', 'latitude' => 'required|numeric', 'longitude' => 'required|numeric'];
 }
 public function find(Route $route)
 {
     $this->usuario = User::find($route->getParameter('usuarios'));
     // marcas es el atributo que figura junto al nombre de la ruta en el archivo de rutas.
 }
 public function find(Route $route)
 {
     $this->tipo = Tipo::find($route->getParameter('tipo'));
 }
 public function rules()
 {
     return ['titulo' => 'required|unique:cms_noticias,titulo,' . $this->route->getParameter('cmsnoticia')];
 }
 /**
  * Find the Company or App Abort 404.
  */
 public function findCompany(Route $route)
 {
     $this->company = Company::findOrFail($route->getParameter('companies'));
 }
Example #24
0
 public function find(Route $route)
 {
     $this->post = Post::find($route->getParameter('post'));
 }
Example #25
0
 public function find(Route $route)
 {
     $this->datos = User::find($route->getParameter('usuarios'));
 }
Example #26
0
 public function find(Route $route)
 {
     $this->user = User::find($route->getParameter('account'));
 }
Example #27
0
 /**
  * Substitute the implicit Eloquent model bindings for the route.
  *
  * @param  \Illuminate\Routing\Route  $route
  * @return void
  */
 public function substituteImplicitBindings($route)
 {
     $parameters = $route->parameters();
     foreach ($route->signatureParameters(Model::class) as $parameter) {
         $class = $parameter->getClass();
         if (array_key_exists($parameter->name, $parameters) && !$route->getParameter($parameter->name) instanceof Model) {
             $method = $parameter->isDefaultValueAvailable() ? 'first' : 'firstOrFail';
             $model = $class->newInstance();
             $route->setParameter($parameter->name, $model->where($model->getRouteKeyName(), $parameters[$parameter->name])->{$method}());
         }
     }
 }
Example #28
0
 public function findUser(Route $route)
 {
     $this->user = User::findOrFail($route->getParameter('users'));
 }
Example #29
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules(Route $route)
 {
     $id = $route->getParameter('landing') ? ",{$route->getParameter('landing')}" : null;
     return ['category_id' => 'required', 'title' => 'required|between:4,255', 'permalink' => ['required', 'between:4,255', 'unique:landing_pages,permalink' . $id], 'image' => 'image|mimes:jpg,jpeg,png,gif', 'image_alt' => 'between:4,255', 'description' => 'required|between:4,255', 'content' => 'required|min:8', 'meta_title' => 'required|between:4,70', 'meta_description' => 'required|between:4,160'];
 }
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     return ['nombre_sector' => 'required|unique:sector_inversion,nom_sector_inversion,' . $this->route->getParameter('sectorInversion')];
 }