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

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