本文整理汇总了PHP中Illuminate\Http\Request::capture方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::capture方法的具体用法?PHP Request::capture怎么用?PHP Request::capture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Http\Request
的用法示例。
在下文中一共展示了Request::capture方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onUserLogin
public function onUserLogin($user, $remember)
{
$request = Request::capture();
$user->last_login = Carbon::now();
$user->ip_address = $request->ip();
$user->save();
}
示例2: run
public function run()
{
$request = Request::capture();
$config = $this->app->get("config");
$action = $request->input($config->get('app.request_action'), '/');
$responseContent = $this->runActionController($action);
if (!$responseContent) {
return;
}
$response = new Response($responseContent);
$response->send();
die;
}
示例3: update
public function update($QuestionID)
{
if (!AuthController::checkPermission()) {
return redirect('/');
}
$data = Request::capture();
$count = $data['numAnswer'];
// delete all old spaces with corresponding answers
$oldSpaces = Spaces::where('QuestionID', '=', $QuestionID)->get()->toArray();
foreach ($oldSpaces as $value) {
SpacesController::destroy($value['id']);
}
for ($i = 0; $i < $count; $i++) {
$rawAnswer = trim(AnswersController::c2s_convert($data['answer' . ($i + 1)]));
preg_match_all('/([^;]+);/', $rawAnswer, $matches, PREG_PATTERN_ORDER);
$arrayOfAnswer = $matches[1];
$SpaceID = DB::table('spaces')->insertGetId(['QuestionID' => $QuestionID, 'created_at' => new \DateTime(), 'updated_at' => new \DateTime()]);
$true = true;
foreach ($arrayOfAnswer as $value) {
$a = new Answers();
$a->Logical = $true;
$a->SpaceID = $SpaceID;
$a->Detail = trim($value);
$a->save();
$true = false;
}
}
return redirect(route('user.viewquestion', $QuestionID));
}
示例4:
function __construct($query, $id)
{
$this->query = $query;
$this->id = $id;
$this->Request = Request::capture();
return $this;
}
示例5: saveAction
public function saveAction()
{
$request = Request::capture();
echo '<pre>';
var_dump($request);
die;
}
示例6: getFilters
/**
* Get Table Filter
*
* @author WN
* @return Collection
*/
protected function getFilters()
{
if (!$this->filters) {
$this->filters = Collection::make(Request::capture()->except(['limit', 'page', 'download']));
}
return $this->filters;
}
示例7: setGlobal
public function setGlobal(swoole_http_request $request)
{
$global_arr = ['get' => '_GET', 'post' => '_POST', 'files' => '_FILES', 'cookie' => '_COOKIE', 'server' => '_SERVER'];
foreach ($global_arr as $skey => $globalname) {
if (!empty($request->{$skey})) {
${$globalname} = $request->{$skey};
} else {
${$globalname} = [];
}
}
if (!empty($_SERVER)) {
foreach ($_SERVER as $key => $value) {
$_SERVER[strtoupper($key)] = $value;
}
}
$_REQUEST = array_merge($_GET, $_POST, $_COOKIE);
$_SERVER['REQUEST_METHOD'] = $request->server['request_method'];
$_SERVER['REQUEST_URI'] = $request->server['request_uri'];
$_SERVER['REMOTE_ADDR'] = $request->server['remote_addr'];
foreach ($request->header as $key => $value) {
$_key = 'HTTP_' . strtoupper(str_replace('-', '_', $key));
$_SERVER[$_key] = $value;
}
\Illuminate\Http\Request::capture();
}
示例8: getPageLimit
/**
* Get Page Limit
*
* @author MS
*/
protected function getPageLimit()
{
if (Request::capture()->get('limit') && is_numeric(Request::capture()->get('limit'))) {
return Request::capture()->get('limit');
}
return static::PAGE_LIMIT ? static::PAGE_LIMIT : 15;
}
示例9: saveQuestion
public function saveQuestion($PostID)
{
if (!AuthController::checkPermission()) {
return redirect('/');
}
$data = Request::capture();
$question = new Questions();
$question->PostID = $PostID;
$question->ThumbnailID = $data['ThumbnailID'];
$question->Question = $data['Question'];
$question->Description = $data['Description'];
switch ($data['ThumbnailID']) {
case '1':
// Photo
$question->save();
$question = Questions::orderBy('id', 'desc')->first();
//Photo
$file = Request::capture()->file('Photo');
if ($file != null) {
$question->Photo = 'Question_' . $PostID . '_' . $question->id . "_-Evangels-English-www.evangelsenglish.com_" . "." . $file->getClientOriginalExtension();
$file->move(base_path() . '/public/images/imageQuestion/', $question->Photo);
}
$question->update();
break;
case '2':
// Video
$linkVideo = $data['Video'];
$question->Video = PostsController::getYoutubeVideoID($linkVideo);
$question->save();
break;
}
echo $question->id;
return;
}
示例10: setActive
public static function setActive($path, $active = 'active')
{
//funcion para agregar la clase active en el menu del sistema
if (Str::contains(Request::capture()->path(), 'auth')) {
return '';
}
return Str::contains(Request::capture()->path(), $path) ? $active : '';
}
示例11: transformException
/**
* Transform a Laravel exception into an API exception.
*
* @param Exception $exception
* @return void
*/
protected function transformException(Exception $exception)
{
if (Request::capture()->wantsJson()) {
$this->transformAuthException($exception);
$this->transformEloquentException($exception);
$this->transformValidationException($exception);
}
}
示例12: run
public function run()
{
$router = new Router(new Dispatcher($this->container), $this->container);
$router->get('/', HomeController::class . '@index');
$router->get('/responsabilidad/{id}', HomeController::class . '@show');
$response = $router->dispatch(Request::capture());
$response->send();
}
示例13: run
public function run()
{
$router = new \Illuminate\Routing\Router(new \Illuminate\Events\Dispatcher($this->container), $this->container);
$router->get('/', \platzi\Http\Controllers\HomeController::class . '@index');
$router->get('/post/{id}', \platzi\Http\Controllers\HomeController::class . '@show');
//$request = Request::capture();
$response = $router->dispatch(\Illuminate\Http\Request::capture());
$response->send();
}
示例14: __construct
private function __construct($name)
{
$this->request = Request::capture();
$this->db = app(DatabaseManager::class);
if (!$this->request->has('_DataTableQuery')) {
throw new \Exception('Invalid input data for DataTableQuery: ' . print_r($this->request->all(), true));
}
$this->filters = json_decode($this->request->_DataTableQuery[$name])->{$name};
}
示例15: render
/**
* Render a tree.
*
* @return \Illuminate\Http\JsonResponse|string
*/
public function render()
{
if (Request::capture()->has('_tree')) {
return response()->json(['status' => $this->saveTree(Request::capture()->get('_tree'))]);
}
$this->buildupScript();
AdminManager::script($this->script);
view()->share(['path' => $this->path]);
return view('admin::tree', $this->variables())->render();
}