本文整理汇总了PHP中Illuminate\Http\Request::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::toArray方法的具体用法?PHP Request::toArray怎么用?PHP Request::toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Http\Request
的用法示例。
在下文中一共展示了Request::toArray方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$data = $request->toArray();
$data['amount'] = preg_replace("/[^0-9\\.]/", "", $data['amount']);
Expense::create($data);
return redirect('/expense');
}
示例2: selectCar
/**
* Show Insurance page.
*
* @param Request $request
*
* @return Redirect
*/
public function selectCar(Request $request)
{
/*
* Put all the request info including order info
* to session, for next pages use.
*/
Session::put('orderInfo', $request->toArray());
return redirect('/reservation/insurance');
}
示例3: authenticate
/**
* Login In User
*
* @param Request $request
* @return \Symfony\Component\HttpFoundation\Response
*/
public function authenticate(Request $request)
{
$validator = $this->getValidationFactory()->make($request->toArray(), ['credential' => 'required', 'password' => 'required|min:6']);
if ($validator->fails()) {
return response()->json(['error' => $validator->errors()]);
}
$field = filter_var($request->input('credential'), FILTER_VALIDATE_EMAIL) ? 'email' : 'username';
$request->merge([$field => $request->input('credential')]);
if (!$this->auth->attempt($request->only($field, 'password'))) {
return response()->json(['error' => 'invalid_username_or_password']);
}
dispatch(new GenerateTokenJob($this->auth->user(), true));
/** @var User $user */
$user = $this->auth->user()->load('codes', 'codes.product', 'codes.product.extras', 'codes.product.profile');
/**
* inject product combination if not admin
*/
$this->injectProductCombo($user);
/**
* Give all Products to admins
*/
$this->adminFunction($user);
return response()->json($user);
}
示例4: toArray
/**
* Get all of the input and files for the request.
*
* @return array
* @static
*/
public static function toArray()
{
return \Illuminate\Http\Request::toArray();
}
示例5: sort
public function sort(Request $request)
{
$this->getQuery()->where($request->toArray());
return $this->response();
}
示例6: index
public function index(Request $request)
{
// Handles requests such as ".../api/agendas?description='hej'"
return response(Agenda::where($request->toArray())->get());
}
示例7: manyToMany
/**
* ManyToMany generate.
*
* @param \Illuminate\Http\Request
*
* @return \Illuminate\Http\Response
*/
public function manyToMany(Request $request)
{
if ($this->check($request->toArray())) {
Session::flash('status', 'Error! can not be related');
return redirect('scaffold');
}
$manytomany = new \Amranidev\ScaffoldInterface\ManyToMany\ManyToMany($request->except('_token'));
$manytomany->burn();
Session::flash('status', 'ManyToMany generated successfully');
return redirect('/scaffold');
}
示例8: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
\Log::info('request', $request->toArray());
return $next($request);
}
示例9: index
public function index(Request $request)
{
// Handles requests such as ".../api/activities?agenda_id=1&type=someType"
return response(Activity::where($request->toArray())->get());
}