Laravel 8: How to style output at Models

I want to check if the status of users is Active or not. So in order to do this, I’ve added this piece of code to my Model User.php: public function isActive() { if(($this->status) == 1)…

How to name a policy for multimodel route in Laravel?

I’m trying to write a policy for this route: Route::delete( ‘users/{user}/locations/{location}’, [UserLocationController::class, ‘destroy’], )->middleware(‘can:delete,user,location’); but …

Laravel won’t send anymore mails after testing my job class on prouction using “QUEUE_DRIVER=sync” [closed]

At first, it sends some emails then stopped without giving any errors, I tested tinker and it gives “null” without receiving anything!! this is my config MAIL_DRIVER=smtp MAIL_HOST=smtp….

illuminate vendors not found in PhpStorm since Laravel 8.36 upgrade

Since I’ve updated to Laravel 8.36 PhpStorm can’t autocomplete and doesn’t find the vendors… what’s the problem ?

Laravel How to set default time as today in daterange filter and how to display the data?

Hi i want to set value of my daterange filter as real-time like today is 5 April 2021 so the default of my daterange filter become from 5 April 2021 to 5 April 2021 and also display the data from my …

Youtube Data API UnknowPart Error When Create Broadcasting

I’m trying to create Youtube live stream through my webpage via Youtube Data API. Whatever I tried, keep getting that error: { “error”: { “code”: 400, “message”:…

Populate database table with Laravel Faker from pre-populated table

I want to populate a table with listings of car offers with dummy data. The specific is that I want the make and model to be from a table already created in the database. Also the listing’s title to …

Failed login attempts via nginx/laravel API calls

I was dealing with an issue where my API site was not accessible either by my iOS app or by a web client. I fixed the issue and can now visit the API site via web client, but now am unable to login to …

How to optimize an increment query in Laravel?

in a Laravel project I am incrementing views based on session I am using it like this: $post = Post::whereSlug($slug)->firstOrFail(); $postKey = ‘post_’.$post->id; if (!Session::has($postKey)) …

Undefined variable $services

I have this error. I did this a couple of times on a different pages with different subjects , but with the same method. It always worked. But for some reason now I’m getting this error. Undefined …