I am trying to Seed a database using a Model Factory in Laravel but am seeing this error on the terminal. From the multiple solutions I have tried, it seems the issue is at the faker-generated content level, but I need that faker content for the factory to work as intended. Below are the Factory and Migration classes that will
Tag: laravel
Does Laravel 8 require PHP 8.1?
So.. I developed a project with Laravel 9, then I had to upload it to my client’s server by FTP ( which was slow and painful ) to find out only afterwards that my client’s server PHP version could not go over 8.0. I tried to open the project live link ( to where I uploaded ) and the composer
Too few arguments to function AppHttpControllersHomeClientLogoController::EditClientImage() Controller Laravel
I am using Laravel 9 and I am getting this error I tried various methods to fix this issue but I’m stuck on this . Please help me. Here is my code: I have passed Id with the route and capture. Here is the code. :- And this is my controller code . and an error is showing in line
Undefined property: $client while trying to get some information
I’m using Laravel v5.8 and guzzlehttp of v7.4 and tried to write this Controller for getting some information: But now when I call the method getInfo, I get this error message: Undefined property: AppHttpControllersTavanmandAppResultController::$client However the docs says calling the uri’s like this. So what’s going wrong here? How can I solve this issue? Answer The scope of your $client
Category filtering in Laravel
Hey guys I’m currently trying to resolve why my legacy code doesn’t work the way it was intended to do so. It’s a basic category filter. My current problem is that I don’t really know what to fix. I tried changing up whereHas, whereIn, orWhere query statement. When I changed orWhere to just simply where, the filter worked only if
How to handle validation of multiple hidden fields
I have created a form where in many cases some fields are not displayed until user select a certain option that will make the particular field displayed, this is controlled by HTML onchange Event Attribute with functions in script. To this point everything works fine. Problem: In the Request class I am implementing some rules for validation , for all
Best way to obtain prefix and last part of url in Laravel
I have a group route like this PHP LARAVEL 9 In the controller side I want to obtain the accomodations part and the italy greece part without slashes. I’m doing like this PHP LARAVEL 9 This works but the way I’m manipulating the request in $listType seems a little bloated to me, is there a cleaner way in laravel? Answer
Can we delete the Resources folder in Laravel after building the project?
In Laravel 9 where it uses Vite to bundle the js and css files, after running it created the bundled js and css files inside public/build folder. Can we now delete the original js and css files that are created inside resources? or to upload the project to hosting without this resources folder? Also, if I have other css/js files
How to join two tables in mysql that has different connections of mysql on different server laravel
I tried this query below and got a database query builder not converted to string error Answer Eloquent does not support joining data from different connections. If both databases are stored on different servers, the only thing you can do is to fetch relevant data from both connections and then join it programatically. Joining data from different databases is possible
how to get month name from month-year (08-2022) string in php
how to get month name from month-year (08-2022) string in php i want to get this Aug-2022 (format) from my value 08-2022 I had tried date(‘m-Y’,strtotime(08-2022)) and date(’08-2022′)->format(‘m-Y’) but not working. Answer Just put a “01-” in front of your value to make it a valid date. try self: https://3v4l.org/ZiB70 or with DateTime: Important NOTE: That ! in the format