Laravel Requests - handling request and Request validation
Questions tagged [laravel-request]
218 questions
1
vote
1 answer
How to redirect on register page if otp verified otherwise redirect to login Laravel?
I am using Laravel 8 and Firebase to verify mobile with OTP. Now I want that if OTP verified then i can access register page if OTP is not verified then redirect to login page.
Now I am using default Laravel registration form and when OTP verified i…

Irshad Khan
- 161
- 2
- 15
1
vote
1 answer
Laravel 8: GET params can't be accessed in Middleware's Request's inputs
I have defined this route in the web.php route file:
Route::get('/middleware_test_user_project_change/{pro_id}/{projet_id}', function ($pro_id, $projet_id) {
return 'test';
})->middleware('user.project.change');
I have defined this handle…

JarsOfJam-Scheduler
- 2,809
- 3
- 31
- 70
1
vote
1 answer
How to add the trim function to validation rules in Laravel Request?
I have a validation rule as shown below. I am using exists to ensure that the contract is unique. The issue now is that contract numbers are stored with spaces in the database so this validation is not working for those cases (for example it will…

Fokwa Best
- 3,322
- 6
- 36
- 51
1
vote
1 answer
Laravel exist validation - combination of column
I have two tables one is banking and another one is a type (banking types). banking table has many types and types that belong to banking. once I create the account, I need to validate banking type_id and banking_id in the types table (i need to…

Nishantha Kumara
- 345
- 2
- 16
1
vote
1 answer
How to return errors in Laravel Custom Request to Ajax
I made custom request as following.
class CustomRequest extends FormRequest
{
public function authorize()
{
return true;
}
public function rules()
{
$rule['name']='required';
$rule['email'] =…

LoveCoding
- 1,121
- 2
- 12
- 33
1
vote
1 answer
Laravel 5.6 ERR_TOO_MANY_REDIRECTS on GET request
I have a custom Request class which deals with the validation of a form. This form uses 'GET' and will filter down all the results the User can see on the page.
My rule for the start date:
'date_start' => 'nullable|date|required_with:date_end',
is…

party-ring
- 1,761
- 1
- 16
- 38
1
vote
0 answers
How to add custom method to $request in Laravel 5.7?
I've built an app where I have two different models with login functionality. People can either login like normal as a User or they can login as an Employer. Here's the Employer model:

Connor Leech
- 18,052
- 30
- 105
- 150
1
vote
1 answer
laravel: avoid miscellaneous parameters in get method
For example I have this url:
http://127.0.0.1/public?valid=test1&invalid=test2
So I send 2 parameters to a related function in its controller:
$input = $request->all();
$validator = Validator::make($input, [
'valid' =>…

Areza
- 671
- 14
- 26
1
vote
1 answer
Laravel GET Request variables mixed up with url
Observing weird behaviour with the GET request in Laravel 5.7 Facebook Socialite login. Suddenly stopped working and here is what I have found:
At user click login with facebook redirect works correctly, comes back with code get variable in url to…

Vlad
- 131
- 2
- 8
1
vote
1 answer
Resize and replace image in Laravel request
I need to be able to resize an image and put the resized version back into the $request, does anyone know if thats possible?
Basically I have inherited some code that contains potentially 100+ separate file upload sections, and it is now my task to…

S_R
- 1,818
- 4
- 27
- 63
1
vote
4 answers
Laravel 5.6 - Cannot change the uploaded file name in $request, temporary name is inserted in the database
I created a form with file and uploads the file and stores the data in the database very well. The problem is, I need to store the modified file name in the database but the Laravel stores the temporary name in the database. This is the code
public…

M a m a D
- 1,938
- 2
- 30
- 61
1
vote
1 answer
Laravel 5.7 - upload to public folder
I know this question has been posted several times, but I can't get it.
Now I use :
// photo upload
$dir = strtolower(str_random(2));
$image = $request->file('image')->store('products/'. $dir);
It works perfectly, my file is uploaded to…

Vincent Decaux
- 9,857
- 6
- 56
- 84
1
vote
1 answer
Authorize a form request only if it an ajax call
I have a form that i want to authorize only if the call was made by ajax, so i tried
....
//MyRequest authorize function
public function authorize()
{
return $this->ajax();
}
But after when i do the ajax call, in the console it shown "This…

Carlos Salazar
- 1,818
- 5
- 25
- 48
1
vote
3 answers
Laravel request helper in URL to get ID / Resource ID
I'm working on a Laravel 5.6 app and have the following two API routes:
Route::resource('/partners', 'API\Partners\PartnersController');
Route::resource('/partners/{id}/sales-team', 'API\Partners\SalesTeamController');
In both of the controllers I…

Lovelock
- 7,689
- 19
- 86
- 186
1
vote
0 answers
Laravel store form file in alternative folder and access in request
At the moment, my application is stored on a Linux server (I do not have control of the server, so server adjustments are out of the question).
In my application there is a form where users can upload excel and CSV files, the request is then being…

S_R
- 1,818
- 4
- 27
- 63