本文整理汇总了PHP中Request::query方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::query方法的具体用法?PHP Request::query怎么用?PHP Request::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Request
的用法示例。
在下文中一共展示了Request::query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configurations
public function configurations()
{
$type = \Request::query('type', 'frontend');
$theme = \Request::query('theme', 'default');
//exit('themes/'.$type.'/'.$theme.'/config');
return $this->theme->view('theme.configurations', ['configurations' => $this->configrationRepository->lists('themes/' . $type . '/' . $theme . '/config'), 'configurationRepository' => $this->configrationRepository])->render();
}
示例2: paginatedCollection
public function paginatedCollection(Paginator $paginator, $transformer = null, $resourceKey = null)
{
$paginator->appends(\Request::query());
$resource = new Collection($paginator->getCollection(), $this->getTransformer($transformer), $resourceKey);
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return $this->manager->createData($resource)->toArray();
}
示例3: _send_message
/**
* Sends the HTTP message [Request] to a remote server and processes
* the response.
*
* @param Request $request request to send
* @param Response $request response to send
* @return Response
*/
public function _send_message(Request $request, Response $response)
{
$http_method_mapping = array(HTTP_Request::GET => HTTPRequest::METH_GET, HTTP_Request::HEAD => HTTPRequest::METH_HEAD, HTTP_Request::POST => HTTPRequest::METH_POST, HTTP_Request::PUT => HTTPRequest::METH_PUT, HTTP_Request::DELETE => HTTPRequest::METH_DELETE, HTTP_Request::OPTIONS => HTTPRequest::METH_OPTIONS, HTTP_Request::TRACE => HTTPRequest::METH_TRACE, HTTP_Request::CONNECT => HTTPRequest::METH_CONNECT);
// Create an http request object
$http_request = new HTTPRequest($request->uri(), $http_method_mapping[$request->method()]);
if ($this->_options) {
// Set custom options
$http_request->setOptions($this->_options);
}
// Set headers
$http_request->setHeaders($request->headers()->getArrayCopy());
// Set cookies
$http_request->setCookies($request->cookie());
// Set query data (?foo=bar&bar=foo)
$http_request->setQueryData($request->query());
// Set the body
if ($request->method() == HTTP_Request::PUT) {
$http_request->addPutData($request->body());
} else {
$http_request->setBody($request->body());
}
try {
$http_request->send();
} catch (HTTPRequestException $e) {
throw new Request_Exception($e->getMessage());
} catch (HTTPMalformedHeaderException $e) {
throw new Request_Exception($e->getMessage());
} catch (HTTPEncodingException $e) {
throw new Request_Exception($e->getMessage());
}
// Build the response
$response->status($http_request->getResponseCode())->headers($http_request->getResponseHeader())->cookie($http_request->getResponseCookies())->body($http_request->getResponseBody());
return $response;
}
示例4: getInvitee
public function getInvitee($username)
{
$lender = LenderQuery::create()->useUserQuery()->filterByUsername($username)->endUse()->findOne();
$lenderInviteVisit = InviteVisitQuery::create()->findOneById(Session::get('lenderInviteVisitId'));
if (!$lender) {
return Redirect::route('/');
}
$ycAccountCredit = TransactionQuery::create()->filterByUserId(Setting::get('site.YCAccountId'))->getTotalBalance();
if ($ycAccountCredit->getAmount() < 5000) {
return View::make('lender.invite-inactive');
}
if (!Auth::check()) {
$lenderInvite = $shareType = null;
if (Request::query('h')) {
$lenderInvite = InviteQuery::create()->filterByLender($lender)->findOneByHash(Request::query('h'));
$shareType = $lenderInvite ? 1 : null;
} else {
$shareType = Request::query('s') ?: 0;
}
$isNewVisit = !$lenderInviteVisit || $lenderInviteVisit->getLenderId() != $lender->getId();
if ($isNewVisit && $shareType !== null) {
$lenderInviteVisit = $this->lenderService->addLenderInviteVisit($lender, $shareType, $lenderInvite);
Session::put('lenderInviteVisitId', $lenderInviteVisit->getId());
return Redirect::route('lender:invitee', ['username' => $lender->getUser()->getUsername()]);
}
}
return View::make('lender.invitee', compact('lender'));
}
示例5: sort_table_by
function sort_table_by($sortBy, $text, $url = null)
{
$currentDirection = Request::get('sort_direction');
$currentSortBy = Request::get('sort_by');
$iconDirection = "fa-sort";
$sortDirection = $currentDirection == 'asc' ? 'desc' : 'asc';
// changes the little icon for us
if ($currentSortBy == $sortBy) {
$iconDirection = $currentDirection == 'asc' ? "fa-sort-up" : "fa-sort-down";
}
$url = $url ?: Request::url() . "?sort_direction={$sortDirection}&sort_by={$sortBy}";
// we want to keep additional query parameters on the string
// so we loop through and build query below
foreach (Request::query() as $queryName => $queryValue) {
if (!in_array($queryName, array('sort_by', 'sort_direction'))) {
if (is_array($queryValue)) {
foreach ($queryValue as $value) {
$url .= "&{$queryName}[]={$value}";
}
} else {
$url .= "&{$queryName}={$queryValue}";
}
}
}
return "\n <a class=\"table-sorter-link {$sortBy}\" href=\"{$url}\">\n {$text}\n <i class=\"fa {$iconDirection} pull-right\"></i>\n </a>";
}
示例6: basic_cache_key_generator
/**
* Basic cache key generator that hashes the entire request and returns
* it. This is fine for static content, or dynamic content where user
* specific information is encoded into the request.
*
* // Generate cache key
* $cache_key = HTTP_Cache::basic_cache_key_generator($request);
*
* @param Request $request
* @return string
*/
public static function basic_cache_key_generator(Request $request)
{
$uri = $request->uri();
$query = $request->query();
$headers = $request->headers()->getArrayCopy();
$body = $request->body();
return sha1($uri . '?' . http_build_query($query, NULL, '&') . '~' . implode('~', $headers) . '~' . $body);
}
示例7: pagination_links
/**
* @param $data
* @param null $view
* @return mixed
*/
function pagination_links($data, $view = null)
{
if ($query = Request::query()) {
$request = array_except($query, 'page');
return $data->appends($request)->render($view);
}
return $data->render($view);
}
示例8: getIndex
public function getIndex()
{
$page = Request::query('page') ?: 1;
$paginator = BorrowerQuery::create()->filterByVerified(true)->filterPendingActivation()->orderByCreatedAt()->joinWith('Profile')->paginate($page, 50);
$paginator->populateRelation('Contact');
$paginator->populateRelation('User');
$paginator->populateRelation('Country');
return View::make('admin.borrower-activation.index', compact('paginator'));
}
示例9: query
public static function query(Request $request, array $query = array())
{
$p = $request->query(self::QUERY_PARAM);
if (!empty($p)) {
return array_merge($query, array(self::QUERY_PARAM => $p));
} else {
return $query;
}
}
示例10: index
/**
* GET List Resources
*/
public function index()
{
$pageNum = Request::query('page');
$page = is_null($pageNum) ? 1 : (int) $pageNum;
$data = $this->resource->fetch($page);
$totalRows = $this->resource->getTotalRows();
$extras = array('totalrows' => (int) $totalRows);
return $this->responseMessage($data, 'successful', 200, $extras);
}
示例11: _send_message
/**
* Sends the HTTP message [Request] to a remote server and processes
* the response.
*
* @param Request request to send
* @return Response
*/
public function _send_message(Request $request)
{
// Response headers
$response_headers = array();
// Set the request method
$options[CURLOPT_CUSTOMREQUEST] = $request->method();
// Set the request body. This is perfectly legal in CURL even
// if using a request other than POST. PUT does support this method
// and DOES NOT require writing data to disk before putting it, if
// reading the PHP docs you may have got that impression. SdF
$options[CURLOPT_POSTFIELDS] = $request->body();
// Process headers
if ($headers = $request->headers()) {
$http_headers = array();
foreach ($headers as $key => $value) {
$http_headers[] = $key . ': ' . $value;
}
$options[CURLOPT_HTTPHEADER] = $http_headers;
}
// Process cookies
if ($cookies = $request->cookie()) {
$options[CURLOPT_COOKIE] = http_build_query($cookies, NULL, '; ');
}
// Create response
$response = $request->create_response();
$response_header = $response->headers();
// Implement the standard parsing parameters
$options[CURLOPT_HEADERFUNCTION] = array($response_header, 'parse_header_string');
$this->_options[CURLOPT_RETURNTRANSFER] = TRUE;
$this->_options[CURLOPT_HEADER] = FALSE;
// Apply any additional options set to
$options += $this->_options;
$uri = $request->uri();
if ($query = $request->query()) {
$uri .= '?' . http_build_query($query, NULL, '&');
}
// Open a new remote connection
$curl = curl_init($uri);
// Set connection options
if (!curl_setopt_array($curl, $options)) {
throw new Request_Exception('Failed to set CURL options, check CURL documentation: :url', array(':url' => 'http://php.net/curl_setopt_array'));
}
// Get the response body
$body = curl_exec($curl);
// Get the response information
$code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($body === FALSE) {
$error = curl_error($curl);
}
// Close the connection
curl_close($curl);
if (isset($error)) {
throw new Request_Exception('Error fetching remote :url [ status :code ] :error', array(':url' => $request->url(), ':code' => $code, ':error' => $error));
}
$response->status($code)->body($body);
return $response;
}
示例12: index
/**
* Displays a grid of titles with pagination.
*
* @return View
*/
public function index()
{
$q = Request::query();
//make index page crawlable by google
if (isset($q['_escaped_fragment_'])) {
$series = Title::where('type', 'series')->paginate(16);
return View::make('Titles.CrawlableIndex')->with('movies', $series)->with('type', 'series');
}
return View::make('Titles.Index')->withType('series');
}
示例13: splitUrl
/**
* Split the URL for the current request.
*
*/
public function splitUrl()
{
$url = $this->request->query("url");
if (!empty($url)) {
$url = explode('/', filter_var(trim($url, '/'), FILTER_SANITIZE_URL));
$this->controller = !empty($url[0]) ? ucwords($url[0]) . 'Controller' : null;
$this->method = !empty($url[1]) ? $url[1] : null;
unset($url[0], $url[1]);
$this->args = !empty($url) ? array_values($url) : [];
}
}
示例14: retrieve
static function retrieve()
{
$array_query = explode('/', $_SERVER['REQUEST_URI']);
if ($array_query[0] == APP_W) {
array_shift($array_query);
}
if (end($array_query) == "") {
array_pop($array_query);
}
self::$query = $array_query;
//var_dump($array_query);
}
示例15: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
if (config('app.debug')) {
\DB::enableQueryLog();
}
\View::composer('widgets.categories', function ($view) {
$view->with('categories', \App\Category::ordered()->get());
});
\View::composer(['widgets.categories', 'articles.index'], function ($view) {
$view->with('QUERY', \Request::query());
});
}