I'm proud to announce that our team has released a new package called https://github.com/spatie/laravel-model-flags. This one makes it easy to add flags to any model in your app.

namespace App\Console\Commands; use App\Models\User; use App\Mails\ExtraMail; use Illuminate\Console\Command; use Illuminate\Support\Facades\Mail; class SendExtraMailCommand extends Command { protected $signature = 'send-extra-mail'; protected $description = 'Send extra mail to all users'; public function handle() { $this->info('Sending extra mail to all users...'); User::each(function(User $user) { $this->comment("Sending mail to {$user->email}"); Mail::to($user->email)->queue(new ExtraMail()); }); $this->info('All done!'); }}

I've coded flag-like functionality in multiple projects before, and I'm glad I finally took the time to extract it to package.

This isn't the first time our team has extracted common functionality from a project to a reusable package.
Newsletter

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

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners