laravel-validation Questions

4

I have a user model that needs to have unique email addresses but I also want to allow them to be left blank in case the user has no email...I see in docs there is a way to make a rule for unique a...
Pinder asked 11/6, 2015 at 21:54

3

How can I validate one input with multiple values? I'm using bootstrap tagsinput plugin. It returns all tags in one field. I need to validate this tags - unique. First I'm trying to place this tags...
Peadar asked 6/10, 2017 at 21:13

3

Solved

if the validation fails it's not clear to me how i could pass the old input to fill again the form. I mean, I know how to pass the data when using the Validator class and redirecting after fail wi...
Studhorse asked 23/3, 2015 at 15:42

5

Solved

I gotta validate a price field which needs to be greater than zero (0.01 is valid) so I have the following validation: $request->validate([ 'product_price' => 'required|numeric|gt:0', ]); ...
Relator asked 19/9, 2018 at 3:47

3

Is there any possibility to set FormRequest rules to default use bail rule without typing in it? Instead of: class StoreRequest extends FormRequest { function rules() { return [ 'name' => ...
Guayaquil asked 18/3, 2019 at 7:15

5

Solved

I have installed intervention in Laravel 5.1 and I am using the image upload and resize something like this: Route::post('/upload', function() { Image::make(Input::file('photo'))->resize(300, 2...

1

Solved

I have two resources Organizations OrganizationUsers Given that I want to create in both resources and that the creation must follow specific requirements, I'm using Request rules() and attribu...
Oidea asked 3/3, 2021 at 13:11

6

Solved

Can I ask what have I done wrong in my LoginRequest.php where I've set a condition to redirect to a custom login page if there is any sort of error in the login process? I have my codes as below: &...
Escalator asked 30/5, 2015 at 10:4

5

Solved

I am working in Laravel 5.4 and I have a slightly specific validation rules need but I think this should be easily doable without having to extend the class. Just not sure how to make this work.. ...
Rodent asked 31/3, 2017 at 18:42

2

Solved

This is my FormRequest class <?php namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; use URL; class CaseStudyUpdateRequest extends FormRequest { /** * Determine if t...
Dramamine asked 8/11, 2019 at 14:59

2

I am trying to have this rules in my model 'Email' => 'email|unique:tablename,coloumntoignore,ignoreid', The above rules is to check the unique coloumn except the id to be supplied in the ign...
Quartis asked 29/1, 2015 at 1:53

5

Solved

I'm not getting the response I expect. This is the controller code for a Location web-service request: <?php namespace App\Http\Controllers; use App\Location; use Illuminate\Http\Request; c...
Balance asked 16/9, 2017 at 18:33

2

Solved

Since upgrading laravel from 5.1 to 5.3, I've got couple of odd issues with Validation. When I post a data like this: firstName null And the validation rules are like this: $validator = Valida...
Hipparchus asked 7/11, 2016 at 12:33

3

Solved

I am using laravel 5.6 resources controllers and form request the problem is that i have some inputs that are required on created, but on edit are optionals like file inputs. So i have this form re...

3

Solved

I am making an API and i want return the array of errors with a format as the one that $validator->errors(); generates when i validate the request by the manual way. But i cant manipulate the re...

4

Solved

In my model I defined a few validation rules for date fields using before and after: 'birth_date' => 'required|date|before:today|after:01-jan-1920', 'another_date' => 'required|date|before:t...
Ending asked 11/4, 2016 at 10:30

6

I am trying to submit a form and validate the content. In one of the requests I need to make a special rule. I followed the documentation and it says to use unique and declare a Rule. use Illumina...
Truditrudie asked 14/11, 2016 at 10:36

4

Solved

I am uploading an image file to the input file ImageUpload.I need to check if file has been uploaded then create a unique filename and save it on the server. $file = $request->file('ImageUpload...
Remus asked 24/12, 2018 at 6:14

9

Solved

I am using form request validation method for validating request in laravel 5.I would like to add my own validation rule with form request validation method.My request class is given below.I want t...
Ossifrage asked 1/3, 2015 at 12:48

4

Solved

I wanted to create this extended validation. Validator::extend('my_custom_validation_rule', function ($attribute, $value, $parameters) { // I guess I should be setting the error message for this...
Relentless asked 4/5, 2015 at 7:57

5

I'm trying to create a user update validation through form, where I pass, for example 'password'=>NULL, or 'password'=>'newone'; I'm trying to make it validate ONLY if it's passed as not null...
Graham asked 18/2, 2017 at 18:29

3

Solved

Im trying to get a image from a PUT request for update a user picture(using postman), and make it pass through a validation in Laravel 5.2, for making the call in postman use the following url: h...
Brookhouse asked 19/8, 2016 at 15:26

10

Solved

I want to validate the route parameters in the "form request" but don't know how to do it. Below is the code sample, I am trying with: Route // controller Server Route::group(['prefix' => 'se...
Vigilante asked 14/5, 2015 at 13:11

3

Solved

I want to accept email from just one server when someone is registering, for example "@myemail.com". If any other email address is given it will say your email is not valid. Below is the ...
Incorporable asked 30/1, 2017 at 9:56

1

I have the following test: public function testStoreMemberValidation() { $response = $this->withExceptionHandling()->post('/api/members', [ "name" => "Eve", "age" => "invalid" ], [...
Cards asked 2/11, 2018 at 16:35

© 2022 - 2024 — McMap. All rights reserved.