Skip to content

Tag: laravel-8

Laravel 8: Undefined offset error message

I’m working with Laravel Controllers: When I fill the form that comes with this Controller I get this message: ErrorException Undefined offset: 300 From this line: So what is the problem here? Answer The problem is probably this line: $image[$size] = $imagePath . “{$size}” . $filename; it sh…

Laravel Storage rename file before downlaod

I want to rename a file in the moment before download it in Laravel 8.0: I currently using the following code: But I can’t find a way to rename it before download it. I don’t want to rename the file in S3. Answer You can pass second argument to download method as below

Return JSON details of failed validation with Laravel 8

I’m creating an endpoint to store an Office with two fields: name, address. When validation fails laravel returns status 200 and a welcome page. It should return 4xx and error details with JSON, shouldn’t it? I tried to catch an exception (ValidationError) but I don’t get the error details. …

Laravel 8 resource controller not fetching model

In Laravel 7 fetching a model was pretty straightforward, i just needed to setup mi resource route and make a get to the address: http://localhost/test/public/employee/1 But i cant make it work on Laravel 8, according to my understanding i just need to do this: But dd only returns an empty class: If i do this…