I am new to laravel, can someone explain to me the parameters of morphMany: Answer The MorphMany relationship has the following function signature: Where: $related (required): refers to the related model. e.g: User::class. $name (required): the name of the polymorphic relation, like commentable. $type (option…
Tag: laravel
laravel project deploy to Heroku but bootstrap styles missing
I deploy laravel project on Heroku. but bootstrap styles a missing. bootstrap is in public dir in browser network showing this Showing status blocked Answer You are looking for secure_asset Generate a URL for an asset using HTTPS: In your code:
How can I show subcategories in categories?
Here’s the code: I will like to display parent category and its children under it. Something like this: Category Sub 1 Sub 2 Category – Sub 1 – Sub 2 I want to show data like see demo Database Structure. Both categories and subcategories are in same table. Database Answer Try this: Output:
watch database and wait for changes in laravel
i have a messaging system app and every message has some status in it with 3 types of done , in progress,not started so when i send a message to user B its not started for example so when user B receive the message he changes the status to in progress here i want to send a notification to the
dyld library not loaded – PHP, Laravel, Composer command line commands not working
I updated my PHP version to 7.2 via homebrew and now any laravel,php, and composer command brings this error. I’ve googled the error though no luck! What do I need to install? Why has this now became an error? libldap-2.4.2.dylib Answer I fixed it – I ran…. Then after words a similar error c…
Run php artisan from one Laravel install to another
We have a Laravel deployment website set up under deploy.mysite.com which handles deployments for a multitude of other websites. One other website I’m trying to deploy which is also a Laravel site resides under site2.myothersite.com. Both are on the same server. Deploy calls a script on site2, this depl…
Laravel UUID’s and their uniqueness?
I have two tables, one for lists and another that stores a history of lists that were created. These lists are very temporary and they can be deleted by numerous methods so I add a reason field on the history for that. Now both have a uuid field and I can generate an actual string to store with Laravel’…
Carbon parse to ISO8601
I am trying to get the current time and format it like: “2018-09-26T21:40:29+02:00” But when I try: $isoDate = CarbonCarbon::now()->format(‘c’); as I understood passing a c to format function …
Laravel validation always returns 200 OK from API
I want to separate my validator with my controller, but API always responds with a 200 OK in Postman. Request validation: class PostRequest extends FormRequest { use Types; public function …
How to configure `.env` file in Laravel for sending mail?
Getting error while sending mail from a in Laravel website. local.ERROR: Connection could not be established with host smtp.gmail.com [A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to …