Newest content
-
· 2 mins, 350 words
Laravel Form with jQuery UI Tabs: Validation Error Redirect to Active Tab
-
· 4 mins, 798 words
Nested Resource Controllers and Routes: Laravel CRUD Example
-
Random Quick Laravel Tip:
Prunable trait to automatically remove models from your databaseNew in Laravel 8.50: You can use the Prunable trait to automatically remove models from your database. For example, you can permanently remove soft deleted models after a few days.
1class File extends Model2{3 use SoftDeletes;45 // Add Prunable trait6 use Prunable;78 public function prunable()9 {10 // Files matching this query will be pruned11 return static::query()->where('deleted_at', '<=', now()->subDays(14));12 }1314 protected function pruning()15 {16 // Remove the file from s3 before deleting the model17 Storage::disk('s3')->delete($this->filename);18 }19}2021// Add PruneCommand to your schedule (app/Console/Kernel.php)22$schedule->command(PruneCommand::class)->daily();Tip by @Philo01
-
· 2 mins, 301 words
Create Your Own Blade Directive: Example of br2nl in Laravel
-
· 1 min, 30 words
How to Quickly Create Laravel User with Tinker
-
· Updated Aug 2022 · 6 mins, 1066 words
Multi-Language Routes and Locales with Auth
-
Premium Course: NEW! Advanced Laravel Testing
-
· 2 mins, 248 words
How to Re-Use The Same FormRequest Class for Both store() and update() Actions
-
· Updated Aug 2022 · 2 mins, 323 words
Eloquent withCount(): Get Related Records Amount
-
· 1 min, 41 words
Laravel Breadcrumbs: Show Path to Your Article
-
· 3 mins, 407 words
Group Entries By Day: Collection groupBy() With CallBack Function
-
· 2 mins, 210 words
Embed and Parse Youtube/Vimeo Videos with Laravel Embed Package