本文整理汇总了PHP中Illuminate\Routing\Route::getParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::getParameter方法的具体用法?PHP Route::getParameter怎么用?PHP Route::getParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Routing\Route
的用法示例。
在下文中一共展示了Route::getParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rules
/**
* 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'] = 'confirmed';
return $rules;
}
示例2: validateShowPath
/**
* 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);
}
}
示例3: find
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);
}
示例4: rules
/**
* 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'] = 'confirmed';
$rules['terms'] = '';
return $rules;
}
示例5: find
public function find(Route $route)
{
$manuales = manuales::find($route->getParameter('manuales'));
if (!$manuales) {
abort(404);
}
}
示例6: findChecklist
/**
* 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;
});
}
示例7: findObservationFormatUser
/**
* 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;
});
}
示例8: findWithTrashed
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();
}
}
示例9: detectLocale
/**
* @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');
}
示例10: showCollection
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);
}
示例11: find
public function find(Route $route)
{
$this->blog = Blog::find($route->getParameter('blog'));
}
示例12: findProtocol
/**
* Find the Protocol or App Abort 404.
*/
public function findProtocol(Route $route)
{
$this->protocol = Protocol::findOrFail($route->getParameter('protocols'));
}
示例13: rules
/**
* 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'];
}
示例14: rules
/**
* 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'];
}
示例15: getSlug
/**
* 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');
}