Laravel Requests - handling request and Request validation
Questions tagged [laravel-request]
218 questions
0
votes
1 answer
Laravel Input array of objects to api routes
I'm passing the following request to laravel api, but when I dump the input request, Laravel is returning an empty array.
{
"expense_type" : "payment",
"description" : "test",
"notes" : "My notes",
"expense_date": "2019-01-15",
"cost" :…

Reiah Paul Sam
- 555
- 6
- 16
0
votes
2 answers
How to Use Recursive Relation in Laravel?
I'm using one User table to store the information of three different users. I created the parent first with one parent_id, and now I want to create the student, and I want to give reference of parent id.
My Table has an id, parent_id, name, job,…

Abdul Rehman
- 159
- 1
- 2
- 18
0
votes
0 answers
Is it okay to send Laravel Request object to other functions as parameter?
Is it okay to send Request $request object between the functions?
My Request $request object consists of around 20 inputs. At first in 'store' function, I save about 10 inputs. Then I pass this $request object to another function where I save…

Kalpashree V. Bal
- 300
- 2
- 13
0
votes
0 answers
How to Display Saved Images in Laravel 5.5?
I am trying to show stored images in img element. I have saved an image by using a Laravel built-in function.
$path = $request->file('image')->store('avatars');
According to the above script, the images are saving to:
Storage > app > avatars
I also…

Script Lover
- 331
- 2
- 6
- 15
0
votes
1 answer
Laravel : Creating default object from empty value
I have this following problem while trying to Edit data already existing in my database.
my controller name is UserController.php
Error: Creating default object from empty value.
I can Pull data from my database and post it in my form. when trying…

Demeteor
- 1,193
- 2
- 17
- 33
0
votes
2 answers
Laravel : $request->hasFile() is not working Call to a member function getClientOriginalExtension() on string
I am working with laravel 5.6 for upload a file using HTML form but I am having a problem while retrieving a file in a controller.
When I retrieve it using this way it returns ok return $request; it is retrieving in controller but not in hasFile()…

hamza shan
- 11
- 1
- 4
0
votes
1 answer
laravel bad request status message in console
can someone help me how can I pass error code and message to be able to parse it in a console for example...
in my case - if I don't set any status code it will return status code 200(even tho I use rules for validation) and I can see my custom…

ggoran
- 630
- 2
- 12
- 29
0
votes
1 answer
Laravel: how to use validator for single elements?
I'm trying to make validation of $id and $offer_id inside my function:
public function getMessagesForOffer($id, $offer_id)
{
$validator = Validator::make($request->all(), [
'id' => 'required|numeric',
'offer_id' =>…

gileneusz
- 1,435
- 8
- 30
- 51
0
votes
2 answers
Split Laravel request errors into sections
I'm wanting to be able to split my laravel error messaged into sections.
Lets say I have an insurance policy page that has 3 sections
Driver Details
Car Details
Policy Details
I'm using a laravel request like this
'driver_name' =>…

S_R
- 1,818
- 4
- 27
- 63
0
votes
1 answer
Dynamic form fields should not have same value in Laravel
I'm implementing a form with dynamic fields being added by an add field button. What I need is to prevent some of these fields to have the same value before submission.
Currently my Request rules look like this:
public function rules()
{
return…

James Blackmore
- 11
- 3
0
votes
1 answer
How to validate input file name in laravel 5.6
I want to validate image name in laravel. How can I get the value of input image name and pass it to rules() method in custom created UploadRequest. I want to validate if image name is maximum 20 characters and only alpha numeric.
uploadRequest…

Denis2310
- 939
- 1
- 15
- 41
0
votes
0 answers
Laravel: redirecTo() method is not working correctly
I have been trying to redirect a user after login, users are to be redirected to when a certain condition is fulfilled.
In the LoginController provided by Laravel
line 31->protected function redirectTo(Request $request){
…

Nii
- 71
- 2
- 17
0
votes
2 answers
Laravel validate all images in array (with different input names)
How would I run a validator for every image thats in a request, when the form file names are always different.
My form file names can range from file1 all the way to section_1_image[0][].
I need to create a validation that I can paste in every…

S_R
- 1,818
- 4
- 27
- 63
0
votes
1 answer
Laravel middleware cancel request and keep page in same state
Here's my current issue.
At the moment, I have a page with elements that can be added in and appended via AJAX. These elements contain forms, image uploads etc.
I have a middleware on my entire application that checks the size of any image being…

S_R
- 1,818
- 4
- 27
- 63
0
votes
2 answers
Laravel custom form requests not validating
I'm have created a custom form request in my laravel 5.6 something like this:

Nitish Kumar
- 6,054
- 21
- 82
- 148