🔍 #LaravelTip: Need a job to execute immediately within another job?
❌ Job::dispatch()->onConnection('sync')
✅ Job::dispatchSync()
The first one just sets queue connection, while dispatchSync() guarantees immediate execution before next line.
Key for data consistency!
Jessé Cruz
@ojessecruz
👨🏻💻 Software Engineer 🇧🇷🇺🇸 | Laravel Artisan | Always learning
• • 71 Posts • 2K Views
🚨Laravel Tip: Avoid Race Conditions in Jobs
❌Bad:
$model->items()->create([...]);
$item = $model->items()->first();
✅Good:
$item = $model->items()->create([...]);
Why? Even in isolated jobs, first() can return null because:
- New DB query
- Cache inconsistency
- Commit delays
Always store the create() result directly!
Hey Laravel developers, looking to make your app multilingual? Fear not! This Filament plugin is here to save the day.
t.co/LaZOwOoN7g
I had a few hours today to work on something I’ve been wanting to build. With a full-time job and kids, it’s tough to find time for personal projects, but I’m making small but steady progress every day.
Still need some work, but what u guys think?
ps.: first time showing to someone.
yes, it’s in Portuguese because I will launch in Brazil. But it will have multi language support