Support the ongoing development of Laravel.io →
Requests Eloquent

Hi guys,

I'm retrieving Events from the database and every time I get events from the database I want to check where active_from <= today.

How am I able to define a global scope which will be used when I retrieve a model?

Last updated 3 years ago.
0

Here's shown how it's done softonsofa.com/laravel-how-to-define-and-use-eloquent-global-scopes/

0

Sign in to participate in this thread!

Eventy

Your banner here too?

guidsen guidsen Joined 24 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.