Laravel Model Flags is an awesome package that offers a trait that allows you to add flags to an Eloquent model. $user->hasFlag('receivedMail'); // returns false $user->flag('receivedMail'); // flag the user as having received the mail $user->hasFlag('receivedMail'); // returns true You can install the package via Composer: composer require spatie/laravel-model-flags Behind the scenes, the flags and their relation to a model will be stored in the flags table. To create that flags table, you must publish and run the migrations once with: php artisan vendor:publish --tag="model-flags-migrations" php artisan migrate
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners