当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::query方法代码示例

本文整理汇总了PHP中Illuminate\Http\Request::query方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::query方法的具体用法?PHP Request::query怎么用?PHP Request::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Http\Request的用法示例。


在下文中一共展示了Request::query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: url

 /**
  * Generates a url for Sorter
  *
  * @param string $field
  * @param null|string $path
  * @param boolean $appends
  * */
 public function url($field, $path = null, $appends = true)
 {
     if ($path === null) {
         $path = $this->url->current();
     }
     $queryString = [$this->getFieldIndex() => $field, $this->getDirectionIndex() => $this->getConditionallyDirection($field)];
     $appends && ($queryString += $this->request->query());
     $url = $path . '?' . http_build_query($queryString);
     return $this->url->to($url);
 }
开发者ID:laravellegends,项目名称:sorter,代码行数:17,代码来源:Sorter.php

示例2: getMovies

 /**
  * @return Response
  */
 public function getMovies(Request $request)
 {
     $limit = intval($request->query('limit') ?: 10);
     $offset = intval($request->query('offset') ?: 0);
     $movies = $this->getData();
     return response()->json(['total' => count($movies), 'list' => array_slice($movies, $offset, $limit)]);
 }
开发者ID:RomanUi,项目名称:TestTask,代码行数:10,代码来源:MoviesController.php

示例3: index

 public function index(urlRequest $request)
 {
     //query
     if ($search = $request->query('q')) {
         $articles = Article::search($search)->orderBy('created_at', 'desc')->simplepaginate(18);
     } elseif ($search = $request->query('id')) {
         //查找伪id(photo)
         $search = \App\Article::where('photo', $search)->firstOrFail()->id;
         $articles = DB::table('articles')->where('id', '<=', $search)->orderBy('created_at', 'desc')->simplepaginate(18);
         //伪搜索结果
         $search = $request->query('id');
     } else {
         //DB::代替Article::
         $articles = DB::table('articles')->orderBy('created_at', 'desc')->simplepaginate(18);
     }
     //已经点赞{!!$articles->appends(Request::except('page'))->render()!!}
     //$f = DB::table('votes')->whereuser_id(Auth::user()->id)->lists('votable_id');
     //http://example.com/custom/url?page=N, you should pass custom/url to the setPath
     $articles->setPath('articles');
     //sidebar
     $hotimgs = \App\Article::where('type', 'LIKE', "%jpg%")->orderBy('vote_count', 'desc')->take(10)->get();
     //return $hotimgs;
     $hotreplies = \App\Reply::orderBy('vote_count', 'desc')->limit(10)->get();
     return view('articles.index', compact('articles', 'search', 'hotimgs', 'hotreplies'));
 }
开发者ID:stevejobsii,项目名称:phphub-laravel5.1,代码行数:25,代码来源:ArticlesController.php

示例4: verify

 protected function verify(Request $request)
 {
     if (!($email = $request->query('email')) or !($token = $request->query('token'))) {
         return $this->returnErrorView(trans('authentication::verification.link_invalid'));
     }
     if (!($emailVerification = $this->emailVerificationRepository->where('email', '=', $email)->first())) {
         return $this->returnErrorView(trans('authentication::verification.email_not_found', ['email' => $email]));
     }
     $user = $this->userRepository->where('email', '=', $email)->firstOrFail();
     if ($user->isVerified()) {
         return $this->returnErrorView(trans('authentication::verification.already_verified'));
     }
     if ($emailVerification->attempts >= EmailVerification::MAX_ATTEMPTS) {
         return $this->returnBlockedView();
     }
     if ($token !== $emailVerification->token) {
         $emailVerification->increment('attempts');
         return $this->returnErrorView(trans('authentication::verification.attempt_failed', ['time' => $emailVerification->attempts]));
     }
     if ($emailVerification->created_at->diffInHours(Carbon::now()) >= EmailVerification::TIMEOUT_HOURS) {
         return $this->returnErrorView(trans('authentication::verification.link_expired'));
     }
     $this->userRepository->save($user->verify());
     $this->emailVerificationRepository->delete($emailVerification);
     Auth::login($user);
     return view('authentication::__front.verification.success');
 }
开发者ID:gez-studio,项目名称:gez-mall,代码行数:27,代码来源:VerifyController.php

示例5: index

 public function index($projectId, Request $request)
 {
     $project = Project::findOrFail($projectId);
     if ($request->ajax()) {
         $query = $project->checklists();
         if ($request->query('date')) {
             $query->whereDate('created_at', '=', new Carbon($request->query('date')));
         }
         $checklists = $query->with('subcontractor')->get();
         $checklists->map(function ($checklist) {
             if ($checklist->checkitems()->whereNull('passes')->exists()) {
                 $checklist->passes = false;
             } else {
                 $checklist->passes = true;
             }
             return $checklist;
         });
         return response()->json(compact('checklists'));
     }
     $checklists = $project->checklists->map(function ($checklist) {
         if ($checklist->checkitems()->whereNull('passes')->exists()) {
             $checklist->passes = false;
         } else {
             $checklist->passes = true;
         }
         if ($checklist->checkitems()->wherePasses(false)->exists()) {
             $checklist->hasFailure = true;
         } else {
             $checklist->hasFailure = false;
         }
         return $checklist;
     });
     return view('project-checklists.index')->withProject($project)->withChecklists($checklists);
 }
开发者ID:shavenking,项目名称:project-boomer,代码行数:34,代码来源:ProjectChecklistsController.php

示例6: getSort

 /**
  * To sort item of page.
  * @return   View
  */
 public function getSort(Request $request)
 {
     $this->repo->grabAllLists();
     $model = $this->repo->makeQuery();
     $sortable = true;
     if ($this->repo->isSortFilterFormConfigExists()) {
         $sortable = false;
         if ($request->has('filter')) {
             $sortable = true;
             $filter = array_except($request->query(), $this->filterExcept);
             foreach ($filter as $item) {
                 if (!$item) {
                     $sortable = false;
                 }
             }
             $model = $this->repo->filter($filter, $model);
         }
         view()->share('beforeSortShouldFilter', !$sortable);
         view()->share('filterForm', Formaker::setModel($this->repo->getModel())->make($request->all()));
     }
     $limit = $request->input('perPage', $this->paginationCount);
     $items = $this->repo->showByPage($limit, $request->query(), $model->with($this->relations));
     $data = ['paginationCount' => $limit, 'sortable' => $sortable, 'rules' => $this->functionRules];
     $lister = Lister::make($items, $this->listConfig, $data);
     event('controllerAfterAction', ['']);
     return $this->layout()->with('listEmpty', $items->isEmpty())->with('sortable', $sortable)->with('lister', $lister);
 }
开发者ID:sharenjoy,项目名称:cmsharenjoy,代码行数:31,代码来源:ObjectBaseController.php

示例7: search

 public function search(Request $request)
 {
     $searchTerm = $request->query('quick_s');
     $searchType = $request->query('quick_t');
     switch ($searchType) {
         case 'a':
             $asset = Asset::whereIdentifier($searchTerm)->first();
             if (isset($asset->id)) {
                 return redirect('assets/' . $asset->id);
             } else {
                 return redirect("assets?identifier={$searchTerm}");
             }
             break;
         case 'j':
             $job = Job::whereId($searchTerm)->first();
             if (isset($job->id)) {
                 return redirect('jobs/' . $job->id);
             } else {
                 return redirect("jobs?id={$searchTerm}");
             }
             break;
         case 'jl':
             $jobList = JobList::whereName($searchTerm)->first();
             if (isset($jobList->id)) {
                 return redirect('job-lists/' . $jobList->id);
             } else {
                 return redirect("job-lists?name={$searchTerm}");
             }
             break;
         default:
             $this->view->quick_t = $searchType;
             $this->view->quick_s = $searchTerm;
             return $this->view;
     }
 }
开发者ID:samwilson,项目名称:asset-manager,代码行数:35,代码来源:SearchController.php

示例8: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $accessKey = env('ACCESS_KEY');
     if (!$request->query('key') || $request->query('key') !== $accessKey) {
         return response('Unauthorized.', 401);
     }
     return $next($request);
 }
开发者ID:hotrush,项目名称:Webshotter-microservice,代码行数:15,代码来源:Authenticate.php

示例9: logout

 /**
  * This initiates a logout request across all the SSO infrastructure.
  */
 public function logout(Request $request)
 {
     $returnTo = $request->query('returnTo');
     $sessionIndex = $request->query('sessionIndex');
     $nameId = $request->query('nameId');
     $this->saml2Auth->logout($returnTo, $nameId, $sessionIndex);
     //will actually end up in the sls endpoint
     //does not return
 }
开发者ID:aacotroneo,项目名称:laravel-saml2,代码行数:12,代码来源:Saml2Controller.php

示例10: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($request->query('tmpl')) {
         $finder = app('themes.view.finder');
         $basePath = config('themes.path.frontend', base_path('themes')) . DIRECTORY_SEPARATOR . $request->query('tmpl');
         $finder->setBasePath($basePath);
     }
     return $next($request);
 }
开发者ID:yajra,项目名称:cms-themes,代码行数:16,代码来源:ThemeChanger.php

示例11: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     if ($request->query('list_id') !== NULL) {
         $list = TodoList::find($request->query('list_id'));
         $tasks = $list->tasks;
     } else {
         $tasks = Task::get();
     }
     return response()->json($tasks);
 }
开发者ID:stevesteve,项目名称:todo,代码行数:15,代码来源:TaskController.php

示例12: __construct

 public function __construct(CategoryInterface $repo, Request $request)
 {
     $this->repo = $repo;
     $this->categoryLayerNumber = config('module.category.layer');
     if ($request->query('category')) {
         session()->put('sharenjoy.categoryType', $request->query('category'));
     }
     $this->type = session('sharenjoy.categoryType');
     parent::__construct();
     view()->share('specifyName', pick_trans('menu.' . $this->type . '_category'));
 }
开发者ID:sharenjoy,项目名称:axes,代码行数:11,代码来源:CategoryController.php

示例13: getTokenForRequest

 /**
  * Get the token for the current request.
  *
  * @return string
  */
 public function getTokenForRequest()
 {
     $token = $this->request->query($this->inputKey);
     if (empty($token)) {
         $token = $this->request->bearerToken();
     }
     if (empty($token)) {
         $token = $this->request->getPassword();
     }
     return $token;
 }
开发者ID:delatbabel,项目名称:framework,代码行数:16,代码来源:TokenGuard.php

示例14: serve

 public function serve(Request $request, $filename)
 {
     if (config('attach.sign')) {
         $url = url($request->url(), array_except($request->query(), ['signature', 'expire']));
         $signature = $request->query('signature', '');
         $expiry = $request->query('expiry', 0);
         if (!verify_url_signature($url, $signature, $expiry)) {
             return abort(404);
         }
     }
     return serve_attachment($filename);
 }
开发者ID:znck,项目名称:attach,代码行数:12,代码来源:AttachController.php

示例15: index

 public function index(Request $request)
 {
     $model = $this->model->find(auth()->user()->id);
     ${camel_case($this->base)} = $model;
     $this->title = title_case(trans('livecms::livecms.' . $this->base));
     $this->description = trans('livecms::livecms.homeprofile');
     $this->breadcrumb3 = trans('livecms::livecms.myprofile');
     $this->params = array_merge($request->query() ? $request->query() : []);
     $this->action = 'store';
     $this->view->share();
     return view('livecms::user.profile.home', compact(camel_case($this->base)));
 }
开发者ID:livecms,项目名称:core,代码行数:12,代码来源:ProfileController.php


注:本文中的Illuminate\Http\Request::query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。