Latest Premium Tutorial
-
· 17 mins, 3274 words · premium
17+ Laravel "Bad Practices" You Should Avoid
People keep asking me about "best practices" in Laravel. However, there are clear BAD practices. So, in this article, I will list the most common ones.
Newest content
-
· 2 mins, 241 words
Filament Placeholder vs Hint: When to Use Which?
-
· 4 mins, 679 words
Filament: Get URLs and Route Names for Resources/Pages
-
Random Quick Laravel Tip:
Order by Pivot FieldsWhen working with belongsToMany and pivot tables, you can create extra columns in the pivot table. Then, use
wherePivot()
andorderByPivot()
to create a separate relationship function in the Model, already filtered/ordered the way you need.app/Models/User.php:
public function roles(): BelongsToMany{return $this->belongsToMany(Role::class)->withPivot('active')->withTimestamps();}public function latestActiveRoles(): BelongsToMany{return $this->roles()->wherePivot('active', 1)->orderByPivot('created_at', 'desc');}Some Controller:
$users = User::with('latestActiveRoles')->get(); -
· 2 mins, 227 words
Filament Select: Use HTML with CSS in Options
-
· 3 mins, 574 words
Filament: Hide Relation Manager by Condition
-
· 3 mins, 522 words
Configure Laravel Reverb in Filament Broadcasting
-
Premium Course: Laravel 11 Multi-Tenancy: All You Need To Know
-
· 5 mins, 868 words
Filament: Customize Auth Emails like Reset Password or Verification
-
· 3 mins, 495 words
Filament Table: Modify Base Query by User Role Condition
-
· 4 mins, 672 words
Filament Dependent Dropdowns in Edit Form: Set Select Values
-
· 1 min, 140 words
Filament: Remove Label Text in Resource Form Page
-
· 6 mins, 1068 words
Filament Repeater: Set Values Manually or From Other Fields