laravel-validation Questions

8

Solved

Laravel comes with this validation message that shows file size in kilobytes: file' => 'The :attribute may not be greater than :max kilobytes.', I want to customize it in a way that it shows ...
Coverdale asked 22/12, 2015 at 10:58

9

Solved

Is there is a way of referencing another field when specifying the exists validation rule in Laravel? I want to be able to say that input a must exist in table a, input b must exist in table b AND ...
Carny asked 30/9, 2014 at 12:54

2

Solved

in laravel validation (registering) i want to compare one of the fields with a php variable (it should be equal with that) how can i do this? protected function validator(array $data) { r...
Pritchett asked 18/8, 2017 at 18:17

14

Solved

I'm trying to create customized messages for validation in Laravel 5. Here is what I have tried so far: $messages = [ 'required' => 'Harap bagian :attribute di isi.', 'unique' => ':attribu...
Margarine asked 10/7, 2017 at 9:6

24

I am having my validation rules for unique in the update section. In inserting or adding the unique rule is 'Email' => array('unique:driver_details'), and it will check for the unique coloumn. ...
Swearingen asked 28/1, 2015 at 17:43

9

Solved

I am new to Laravel 5 and I am trying to use the new Form Request to validate all forms in my application. Now I am stuck at a point where I need to DELETE a resource and I created a DeleteResourc...
Glaydsglaze asked 5/5, 2015 at 11:39

6

I am experimenting with Laravel Livewire and I came across a situation where the previous errors are displayed even though the form is successfully submitted. Before hit Save After hitting Save...
Unwept asked 22/3, 2020 at 12:28

4

I'm trying to create a custom validation rule that accept a parameter, but this parameter is the name of another field in the request, like for the required_with rule. I easily can handle given pa...
Burgee asked 21/10, 2019 at 12:54

6

In the documentation, I saw you could set a connection for the unique rule which is great. However, the exists doesn't seem to follow the same logic. Take this for example: $rules = [ 'username' ...
Ardeliaardelis asked 22/9, 2015 at 22:56

3

Solved

When I use the Validation feature in Laravel, how can I add a pre-defined strings that are allowed in an Input? For example, let's say I want the Input to contain only one of the following: ...
Aback asked 15/7, 2015 at 19:18

5

testAjax function inside PostsController class: public function testAjax(Request $request) { $name = $request->input('name'); $validator = Validator::make($request->all(), ['name' => '...
Zoosporangium asked 17/3, 2018 at 7:55

6

Solved

I have done all the things for the validation for the variable in laravel but for emails I got one simple problem. From doc of Laravel, 'email' => 'required|email' I got to know this is for ...
Gorizia asked 5/4, 2015 at 6:35

6

I'm using FormRequest to validate from which is sent in an API call from my smartphone app. So, I want FormRequest alway return json when validation fail. I saw the following source code of Larave...
Lasting asked 20/7, 2015 at 1:51

4

Solved

My question is about Laravel validation rules. I have two inputs a and b. a is a select input with three possible values: x, y and z. I want to write this rule: b must have a value only if a va...
Open asked 24/1, 2018 at 10:55

5

Solved

How to return a custom error message using this format? $this->validate($request, [ 'thing' => 'required' ]);
Groan asked 16/10, 2016 at 5:35

4

Solved

Laravel has a 'unique' rule with an 'except' clause. From the validation documentation, it takes this form: unique:table,column,except,idColumn My application has a 'shop' entity. When the user ...
Hafiz asked 5/12, 2017 at 5:51

5

I recently upgraded to laravel 5.4 (from 5.2) to make use of the nullable validation rule. I have a field act_post_code which can be either an integer OR null. So I provided the following rule in ...
Lubber asked 7/2, 2018 at 23:26

2

Solved

I am developing a Laravel application. What I am doing in my application is that I am trying to override the custom validation rule message. I have validation rules like this in the request class:...
Binder asked 30/5, 2019 at 19:5

4

Solved

I want to know if I have to use a string or an integer for a phone number? I have tried an integer but I have a problem in my validation. ... table->integer('phone'); ... In my validation, ...
Kurdish asked 11/8, 2019 at 9:17

5

Solved

I have the following code in my Laravel 5 app: public function store(Request $request){ $this->validate($request, ['filename' => 'regex:[a-zA-Z0-9_\-]']); } My intentions are to permit fi...
Paryavi asked 28/7, 2016 at 20:50

3

Solved

Is there a built in validator in Laravel 5 that checks if value is in array of my whitelisted values sort of speak.. Something like: $rules = [ 'field_name' => "required|in_array('yes', ...
Sergent asked 3/6, 2015 at 9:51

4

Solved

I am trying to create and update users with laravel 5.4 This is the validation added for create user. It works. $this->validate($request, [ 'name' => 'required|max:255', 'email' => 're...
Mayfly asked 29/3, 2017 at 5:45

2

Solved

I want to validate the route parameters in the Request validation class. I know this question has been asked many times before but According to this question I override all() method and I receive t...

3

I have a form in route('users.create'). I send form data to this function in its contoller: public function store(UserRequest $request) { return redirect(route('users.create')); } for validat...
Sharisharia asked 6/10, 2017 at 23:45

3

I have custom validation rule in my controller: $this->validate($request, [ 'currency' => [ 'required', 'numeric', 'min:0', 'max:7' ], 'price' => [ 'nullable', "required_if:curre...
Danseuse asked 18/12, 2018 at 12:4

© 2022 - 2024 — McMap. All rights reserved.