本文整理匯總了PHP中App\Http\Requests\Request::all方法的典型用法代碼示例。如果您正苦於以下問題:PHP Request::all方法的具體用法?PHP Request::all怎麽用?PHP Request::all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類App\Http\Requests\Request
的用法示例。
在下文中一共展示了Request::all方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: update
/**
* updates activity sector
* @param $id
* @param Request $request
* @param SectorRequestManager $sectorRequestManager
* @return \Illuminate\Http\RedirectResponse
*/
public function update($id, Request $request, SectorRequestManager $sectorRequestManager)
{
$activityData = $this->activityManager->getActivityData($id);
if (Gate::denies('ownership', $activityData)) {
return redirect()->back()->withResponse($this->getNoPrivilegesMessage());
}
$this->authorizeByRequestType($activityData, 'sector');
$sectors = $request->all();
foreach ($sectors['sector'] as &$sector) {
if ($sector['sector_vocabulary'] == 1 || $sector['sector_vocabulary'] == '') {
$sector['sector_vocabulary'] = 1;
$sector['sector_category_code'] = '';
$sector['sector_text'] = '';
} elseif ($sector['sector_vocabulary'] == 2) {
$sector['sector_code'] = '';
$sector['sector_text'] = '';
} else {
$sector['sector_code'] = '';
$sector['sector_category_code'] = '';
}
}
if ($this->sectorManager->update($sectors, $activityData)) {
$this->activityManager->resetActivityWorkflow($id);
$response = ['type' => 'success', 'code' => ['updated', ['name' => 'Sector']]];
return redirect()->to(sprintf('/activity/%s', $id))->withResponse($response);
}
$response = ['type' => 'danger', 'code' => ['update_failed', ['name' => 'Sector']]];
return redirect()->back()->withInput()->withResponse($response);
}
示例2: update
/**
* Just passes everything into the update. If there's a stricter
* requirement,
*
* @param Request $request
* @param $id
* @return mixed
*/
public function update(Request $request, $id)
{
if ($this->repository->find($id)) {
return $this->repository->update($id, $request->all());
}
return null;
}
示例3: updatePost
/**
* Update post
* @param Request $request
* @param int $id
* @return void
*/
public function updatePost(Request $request, $id)
{
DB::beginTransaction();
try {
$post = Post::findOrFail($id);
$oldImage = "";
$inputs = $request->all();
if ($request->hasFile('images')) {
$oldImage = public_path() . config('model.posts.path_folder_photo_post') . $post->images;
$imageFile = $request->file('images');
$inputs['images'] = $this->__storeImagePost($imageFile);
} else {
unset($inputs['images']);
}
if ($inputs['type'] == 2) {
$this->__changeStickyPost($id);
}
$post->fill($inputs);
$post->save();
if (strlen($oldImage) != 0) {
if (File::exists($oldImage)) {
File::delete($oldImage);
}
}
} catch (Exception $e) {
DB::rollback();
throw new Exception("Error Processing Request", 1);
}
DB::commit();
}
示例4: messages
public function messages()
{
$input = parent::all();
$messages = ['doacoes.required' => 'Doação precisa ser informada', 'doacoes.array' => 'Doação precisa ser um conjunto'];
/*
* Verifica se foram passados endereços
* Caso contrário devolver as regras
*/
if (!isset($input['doacoes']) || !is_array($input['doacoes'])) {
return $messages;
}
/*
* Messages para validação dos doacoes(endereços)
* @var array
*/
$doacoesMessages = ['value.required' => 'Você precisa informar um valor', 'value.numeric' => 'O valor precisa ser numérico', 'value.min' => 'Valor mínimo :min'];
$doacoes = $input['doacoes'];
$newMessagens = [];
foreach ($doacoes as $row => $address) {
foreach ($doacoesMessages as $key => $value) {
$newMessagens['doacoes.' . $row . '.' . $key] = $row + 1 . ': ' . $value;
}
}
return array_merge($messages, $newMessagens);
}
示例5: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$input = Request::all();
if ($input['or_number'] != 'Cash' && $input['or_number'] != 'CASH' && $input['or_number'] != 'cash') {
return ['si_no' => 'numeric|unique:sales_invoices', 'dr_number' => 'numeric|unique:sales_invoices', 'or_number' => 'numeric'];
}
return ['si_no' => 'numeric|unique:sales_invoices', 'dr_number' => 'numeric|unique:sales_invoices'];
}
示例6: all
public function all()
{
$attributes = parent::all();
//remove spaces btw words in churcn name
$name = preg_replace("/ {2,}/", " ", $attributes['name']);
$attributes['name'] = $name;
return $attributes;
}
示例7: all
/**
* Alter some request data.
*
* @return array
*/
public function all()
{
$data = parent::all();
if ($data['password'] == config('admin.password_mask') || !$data['password']) {
unset($data['password']);
}
return $data;
}
示例8: all
/**
* Alter some request data.
*
* @return array
*/
public function all()
{
$data = parent::all();
if (isset($data['vintage'])) {
$data['vintage'] = intval($data['vintage']);
}
return $data;
}
示例9: all
public function all()
{
$data = collect(parent::all());
if ($data->has('phone') && $data->get('phone') != '') {
$data->put('phone', preg_replace('/[^0-9]/', '', $data->get('phone')));
}
return $data->toArray();
}
示例10: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$input = Request::all();
if (array_key_exists('save', $input)) {
return ['your-time' => ['required', 'regex:/^([0-5][0-9]|[0-9])?:?([0-5][0-9]|[0-9]):([0-5][0-9]|[0-9])(\\.\\d{1,2})?$/'], 'winners-time' => ['required', 'regex:/^([0-5][0-9]|[0-9])?:?([0-5][0-9]|[0-9]):([0-5][0-9]|[0-9])(\\.\\d{1,2})?$/', 'compare_time:your-time'], 'last-0' => 'required', 'first-0' => 'required', 'last-1' => 'required', 'first-1' => 'required', 'last-2' => 'required', 'first-2' => 'required', 'last-3' => 'required', 'first-3' => 'required', 'last-4' => 'required', 'first-4' => 'required', 'race-name' => 'required', 'distance-km' => ['required', 'numeric'], 'race-location' => 'required', 'hidden-lat' => 'required', 'hidden-long' => 'required', 'gender' => 'required', 'technique' => 'required'];
} else {
return ['your-time' => ['required', 'regex:/^([0-5][0-9]|[0-9])?:?([0-5][0-9]|[0-9]):([0-5][0-9]|[0-9])(\\.\\d{1,2})?$/'], 'winners-time' => ['required', 'regex:/^([0-5][0-9]|[0-9])?:?([0-5][0-9]|[0-9]):([0-5][0-9]|[0-9])(\\.\\d{1,2})?$/', 'compare_time:your-time'], 'last-0' => 'required', 'first-0' => 'required', 'last-1' => 'required', 'first-1' => 'required', 'last-2' => 'required', 'first-2' => 'required', 'last-3' => 'required', 'first-3' => 'required', 'last-4' => 'required', 'first-4' => 'required'];
}
}
示例11: all
public function all()
{
$input = parent::all();
if (array_key_exists('lideranca', $input) && $input['lideranca'] == 'on') {
$input['lideranca'] = true;
} else {
$input['lideranca'] = false;
}
return $input;
}
示例12: messages
/**
* Mensagens personalizadas da validação.
*
* @return array
*/
public function messages()
{
$input = (object) Request::all();
$messages = array();
$messages = ['grupo.unique' => 'Grupo já cadastrado.'];
if ($input->acao != 'excluir') {
$messages = ['ids_selecionados.required' => 'O campo Usuários selecionados é obrigatório.'];
}
return $messages;
}
示例13: all
public function all()
{
$atts = parent::all();
if ($atts['password'] === $atts['password_confirmation']) {
$crypted = bcrypt($atts['password']);
$atts['password'] = $crypted;
$atts['password_confirmation'] = $crypted;
}
return $atts;
}
示例14: rules
/**
* Regras de validação.
*
* @return array
*/
public function rules()
{
$input = (object) Request::all();
if ($input->acao == 'E') {
$validar = array();
} else {
$validar = ['codigo' => "required|min:1|max:15|unique:tbprodutos,codigo,{$input->id}", 'descricao' => 'required|min:1|max:60', 'quantidade' => 'required|numeric', 'preco' => 'required|numeric'];
}
return $validar;
}
示例15: all
/**
* Get all form input.
*
* @return array
*/
public function all()
{
$input = parent::all();
foreach ($this->getBoardOptions() as $optionGroup) {
foreach ($optionGroup->options as $option) {
if (isset($input[$option->option_name])) {
$input[$option->option_name] = $option->getSanitaryInput($input[$option->option_name]);
}
}
}
return $input;
}