Laravel Requests - handling request and Request validation
Questions tagged [laravel-request]
218 questions
0
votes
4 answers
How to redirect user to custom URL (view)?
I have such URL in Laravel 5:
domain.com/search-user/email@domain.net
When I enter this URL, it automatically searches data by given email.
How I should redirect user from other controller to this URL?
I have tried, but it doesn't work:
return…

Linas Lg
- 199
- 2
- 17
0
votes
2 answers
Laravel 5.3 update request with unique rule with exception
I have request for updating page. When adding new page request is like:
'title'=>'required|max:70|unique:pages',
but when I'm updating page title must be unique but need to check all other titles except one already entered.
I searched Google for…

KondukterCRO
- 543
- 2
- 16
- 31
0
votes
1 answer
Laravel 5.3 Observer can't reach the model
I have an Eloquent User model in Laravel. When i creating a new User, i want to create a token automatically for it. I do it with an observer. But in observer, I can't reach the created model, it want to create a new one.
My User model:
namespace…

tthlaszlo
- 435
- 2
- 7
- 14
0
votes
1 answer
Laravel: validation message for same rules in one field
I am new to Laravel, and I try to validate a request. I have to following request class:
namespace App\Http\Requests;
class TestRequest extends FormRequest
{
protected function rules()
{
return [
'group_id' =>…

Zoltán Fekete
- 504
- 1
- 6
- 22
0
votes
2 answers
Using Laravel requests for GET methods?
I've only used Laravel's Requests for POST methods. In the documentation, all examples use POST methods, but the class does offer a method to check which HTTP verb is used.
Is it advisable to use a Request when the method is GET if there is a need…

Shane
- 1,190
- 15
- 28
0
votes
1 answer
laravel 5.1 ErrorException: preg_replace(): Parameter mismatch, pattern is a string while replacement is an array
I have the following model with fillable properties:
class Job extends Model {
protected $fillable = [
'job_type_id',
'recruiter_id',
'start_at',
'end_at',
'job_title',
'job_ref',
'job_desc'
];
…

adam78
- 9,668
- 24
- 96
- 207
0
votes
1 answer
Laravel 5 - calling $request->path() in middleware causing Laravel to ignore changes made to the request URI?
Using Laravel 5.2, and using a middleware, I need to remove a certain part from the URI of the request before it gets dispatched. More specifically, in a url like "http://somewebsite.com/en/company/about", I want to remove the "/en/" part from…

pazof
- 944
- 1
- 12
- 26
0
votes
1 answer
Declaration of App\Http\Requests\Comment\CreateRequest::authorize() should be compatible with App\Http\Requests\Request::authorize()
Hello im creating i comment system for my laravel app but i get this error when i try to comment.. basically when a user is not logged in and he tries to comment and submit it, it should redirect him to the login page, so my CreateRequest file is…

Fatih Akgun
- 479
- 1
- 6
- 18
0
votes
0 answers
How to use laravel package repository with fractal parameter includes?
I am using repository package to make API with laravel.I use transformers to transform data.It works well.
I am wondering how can I use includes with transformers.
As a example I have user class.I want to include UserBook model in User…

IshaS
- 837
- 1
- 10
- 31
0
votes
2 answers
Laravel restful api error 500 (store and destroy)
I am new to restful api, and I met a problem: when I request destroy with delete method and store with post method, both will return 500 error. But I use get method to request index and show, both are ok. What is the problem?
Here is my code and…

vancake
- 151
- 1
- 7
0
votes
1 answer
Laravel, Append Values to Custom Request Error Message
I am building an API, the desired output when there is an error is as follows:
{
"success": false,
"messages" : [
{
"field is missing for example",
....
}
]
}
I have a custom request called when…

Coderji
- 7,655
- 5
- 37
- 51
0
votes
1 answer
Object of class Illuminate\Validation\Validator could not be converted to string
I'm yet to understand what needed to be fixed in the code making it to generate the error. What is to be put right?
This is the code:
public function store(Request $request){
$validator = Validator::make($request->all(), [
…

ken4ward
- 2,246
- 5
- 49
- 89
0
votes
1 answer
Laravel - How to logout and display logout page when user manually enter unauthorized URL
I am beginner of laravel. I am using Role and permission concept for multiple user. If user manually enter URL which is not allow to that user then I want to logout that user.
I have successfully logout the user but display logout page in content…

Rajeev Varshney
- 933
- 2
- 13
- 26
0
votes
0 answers
Laravel 5.2 custom authorization action
I created User Controller policy. In User controller there is a method like this:
public function create(Request $request){
$this->authorize($request->user());
return view('frontpage');
}
Policy for this method works pretty fine, except…

Fusion
- 5,046
- 5
- 42
- 51
0
votes
2 answers
How to get list of users in laravel 5
I am working over a project. I have required some basic values in different routes. e.g. show the list of users, locations, products in different pages/routes. So I wanted to create a common method for these like where i want to show list of users I…

Kapil Verma
- 178
- 3
- 17