本文整理汇总了PHP中App\Http\Requests\Request::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::get方法的具体用法?PHP Request::get怎么用?PHP Request::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Http\Requests\Request
的用法示例。
在下文中一共展示了Request::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: image
/**
* @param Request $request
* @return $this
*/
public function image(Request $request)
{
$user = Auth::User();
if ($request->isMethod('POST')) {
$src = public_path() . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'upload' . DIRECTORY_SEPARATOR . $user->profile->image;
$image = Image::make($src);
$image->crop($request->get('w'), $request->get('h'), $request->get('x'), $request->get('y'));
$image->save($src);
return Redirect::route('profile_path', ['id' => $user->id]);
}
return view('profile.image')->with('user', $user);
}
示例2: response
/**
* Get the proper failed validation response for the request.
*
* @param array $errors
* @return \Symfony\Component\HttpFoundation\Response
*/
public function response(array $errors)
{
if ($this->ajax() || $this->wantsJson()) {
return new JsonResponse(['errors' => $errors, 'message' => '<i class="fa fa-exclamation-circle fa-lg"></i>' . trans('create-project-form.validation-error'), 'element' => Request::get('name')], 200);
}
return $this->redirector->to($this->getRedirectUrl())->withInput($this->except($this->dontFlash))->withErrors($errors, $this->errorBag);
}
示例3: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if (Request::get('old_password') != "" || Request::get('password') != "" || Request::get('password_confirmation') != "") {
return ['old_password' => 'required|confirmed|min:6', 'password' => 'required|confirmed|min:6', 'password_confirmation' => 'required|confirmed|min:6'];
}
return [];
}
示例4: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$tipo_documento_valor = Request::get('per_dcmto_tipo');
$doc_numero = 'required';
$per_dcmto_tipo = 'required';
$per_ruc = 'sometimes';
if (Request::get('per_tipo') == '0002') {
$per_ruc = 'required';
}
if ($tipo_documento_valor == '0001') {
$doc_numero = 'required|numeric|digits:8|unique:persona,per_dcmto_numero';
} else {
if ($tipo_documento_valor == '0002') {
$doc_numero = 'required|max:12';
} else {
if ($tipo_documento_valor == '0003') {
$doc_numero = 'required|numeric|digits:11';
} else {
if ($tipo_documento_valor == '0006' || $tipo_documento_valor == '0004' || $tipo_documento_valor == '0005') {
$doc_numero = 'required|max:12';
}
}
}
}
if (Request::get('per_nacion') == '0002') {
$per_dcmto_tipo = 'required|same:0002';
}
return ['per_tipo' => 'required', 'per_nacion' => 'sometimes|required', 'per_dcmto_tipo' => 'sometimes|' . $per_dcmto_tipo, 'per_dcmto_numero' => 'sometimes|' . $doc_numero, 'per_ape_paterno' => 'sometimes|required', 'per_ape_materno' => 'sometimes|required', 'per_nombre1' => 'sometimes|required', 'per_nombre2' => 'sometimes|sometimes', 'per_razon_social' => 'sometimes|required', 'per_ruc' => $per_ruc, 'per_direccion' => 'required', 'per_ubg_id' => 'required|numeric', 'per_direc_referencia' => 'required'];
}
示例5: getPaginatedEntries
/**
* Returns the entries for the current page for this view.
*
* @return \Illuminate\Pagination\LengthAwarePaginator paginator containing the entries for the page, sorted/ordered or not.
*/
public function getPaginatedEntries()
{
// Gets all the entries, sensitive to whether we're sorting for this request.
$allEntries = $this->getEntriesSortable();
$page = Paginator::resolveCurrentPage('page');
// Returns the number of entries perpage, defined by Model#getPerPage
$perPage = $allEntries->first()->getPerPage();
// If the page number is beyond the number of pages, get it back to the last page.
while (($page - 1) * $perPage > count($allEntries)) {
$page -= 1;
}
// Return the subset of the entries for this page
$entriesForPage = $allEntries->splice(($page - 1) * $perPage, $perPage);
// Return the paginator for this subset.
$entriesPaginator = new LengthAwarePaginator($entriesForPage, $this->getEntries()->first()->toBase()->getCountForPagination(), $perPage, $page, ['path' => Paginator::resolveCurrentPath(), 'pageName' => 'page']);
// If we're ordering, append that to the links
if ($this->getSortOrder()) {
$entriesPaginator->appends(['order' => Request::get('order')]);
}
// If we're sorting, append that to the links
if ($this->isSorting()) {
$entriesPaginator->appends(['sort' => $this->getSortKey()]);
}
return $entriesPaginator;
}
示例6: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if (isset(Request::get('boletos')['cliente_id'])) {
return ['boletos.cliente_id' => 'required', 'boletos.numero' => 'required', 'descricao' => 'required', 'valor' => 'required', 'valor_pago' => $this->method() == 'PUT' ? 'required' : '', 'data_vencimento' => 'required', 'data_pagamento' => $this->method() == 'PUT' ? 'required' : ''];
} else {
return ['boletos.fornecedor_id' => 'required', 'boletos.numero' => 'required', 'descricao' => 'required', 'valor' => 'required', 'valor_pago' => $this->method() == 'PUT' ? 'required' : '', 'data_vencimento' => 'required', 'data_pagamento' => $this->method() == 'PUT' ? 'required' : ''];
}
}
示例7: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if (isset(Request::get('cheque')['cliente_id'])) {
return ['lancamento.valor' => $this->method() == 'PUT' ? '' : 'required', 'lancamento.data_vencimento' => $this->method() == 'PUT' ? '' : 'required', 'lancamento.data_pagamento' => $this->method() == 'PUT' ? 'required' : '', 'cheque.banco_id' => 'required', 'cheque.cliente_id' => 'required', 'cheque.numero' => 'required', 'cheque.nome' => 'required'];
} else {
return ['lancamento.valor' => $this->method() == 'PUT' ? '' : 'required', 'lancamento.data_vencimento' => $this->method() == 'PUT' ? '' : 'required', 'lancamento.data_pagamento' => $this->method() == 'PUT' ? 'required' : '', 'cheque.banco_id' => 'required', 'cheque.fornecedor_id' => 'required', 'cheque.numero' => 'required', 'cheque.nome' => 'required'];
}
}
示例8: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$rules = ['department_id' => 'required|exists:departments,id', 'operator_id' => 'required|exists:users,id', 'expected_meters' => 'required|integer|min:0', 'achieved_meters' => 'required|integer|min:0', 'comment' => 'max:255|string'];
if ((int) Request::get('expected_meters') > (int) Request::get('achieved_meters')) {
$rules = array_merge($rules, ['man' => 'required_without_all:machine,method,material', 'machine' => 'required_without_all:man,method,material', 'method' => 'required_without_all:machine,man,material', 'material' => 'required_without_all:machine,method,man', 'reason' => 'required|max:255|string']);
}
return $rules;
}
示例9: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if (Request::get('id_user')) {
$pass = 'min:5';
} else {
$pass = 'required_with:username|min:5';
}
return ['nama_user' => 'required', 'kelahiran' => 'required', 'jk' => 'required', 'status' => 'required', 'username' => 'required|min:5|max:20|unique:tbl_administrator,username,' . Request::get('id_user') . ',id_user', 'password' => $pass];
}
示例10: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if ($this->method() == 'PUT' || $this->method() == 'PATCH') {
$rule_no = 'required|min:1|numeric|unique:package_courses,no_of_main_courses,' . Request::get('id') . ',id,package_id,' . Request::get('package_id');
} else {
$rule_no = 'required|min:1|numeric|unique:package_courses,no_of_main_courses,null,id,package_id,' . Request::get('package_id');
}
return ['no_of_main_courses' => $rule_no, 'price_per_head' => 'required|min:1|numeric'];
}
示例11: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if (Request::get('id_kepegawaian')) {
$pass = 'min:5';
} else {
$pass = 'required_with:username|min:5';
}
return ['nama_pegawai' => 'required|unique:tbl_kepegawaian,nama_pegawai,' . Request::get('id_kepegawaian') . ',id_kepegawaian', 'jk' => 'required', 'username' => 'required|min:5|max:20|unique:tbl_kepegawaian,username,' . Request::get('id_kepegawaian') . ',id_kepegawaian', 'password' => $pass];
}
示例12: verify
/**
* Verify an Activity.
*
* Changes the ActivityWorkflow status of an Activity to 'Complete'.
*
* @param $id
* @param Request $request
* @return mixed
*/
public function verify($id, Request $request)
{
$activity = $this->workFlowManager->findActivity($id);
if (Gate::denies('ownership', $activity)) {
return redirect()->back()->withResponse($this->getNoPrivilegesMessage());
}
$this->authorize('edit_activity', $activity);
return redirect()->back()->withResponse($this->respondTo($this->workFlowManager->update($request->all(), $this->workFlowManager->findActivity($id)), $request->get('activity_workflow')));
}
示例13: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if (Request::get('id')) {
$password = 'min:5';
} else {
$password = 'required|min:5';
}
return ['first_name' => 'required', 'email' => 'required|email|unique:users,email,' . Request::get('id'), 'password' => $password, 'role' => 'required'];
}
示例14: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if (Request::get('postcode') !== 'Collected') {
return ['address1' => 'required', 'town' => 'required', 'county' => 'required', 'postcode' => 'required'];
} else {
return ['postcode' => 'required'];
}
Request::flash();
}
示例15: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if ($this->method() == 'PUT' || $this->method() == 'PATCH') {
$name_rule = 'required|min:3|unique:menus,name,' . Request::get('id');
} else {
$name_rule = 'required|min:3|unique:menus';
}
return ['name' => $name_rule];
}