Latest Premium Tutorial
-
· 11 mins, 2097 words · premium
Laravel Reverb Demo: Real-Time Notification on Completed Task
Some Laravel tasks are running in the background. What if you want to "listen" for those events to finish? Let's implement exactly this real-time feedback with the Reverb server.
Newest content
-
· 2 mins, 215 words
This Week: 40% Discount for Yearly and Lifetime Plans!
-
· 1 min, 107 words
Laravel 11: New Artisan "make:trait" Command
-
Random Quick Laravel Tip:
Use Redis to track page viewsTracking something like page views with MySQL can be quite a performance hit when dealing with high traffic. Redis is much better at this. You can use Redis and a scheduled command to keep MySQL in sync on a fixed interval.
Route::get('{project:slug', function (Project $project) {// Instead of $project->increment('views') we use Redis// We group the views by the project idRedis::hincrby('project-views', $project->id, 1);})// Console/Kernel.php$schedule->command(UpdateProjectViews::class)->daily();// Console/Commands/UpdateProjectViews.php// Get all views from our Redis instance$views = Redis::hgetall('project-views');/*[(id) => (views)1 => 213,2 => 100,3 => 341]*/// Loop through all project viewsforeach ($views as $projectId => $projectViews) {// Increment the project views on our MySQL tableProject::find($projectId)->increment('views', $projectViews);}// Delete all the views from our Redis instanceRedis::del('project-views');Tip given by @Philo01
-
· 1 min, 110 words
Laravel 11: New Artisan "make:interface" Command
-
· 1 min, 159 words
Laravel 11: New Artisan "make:enum" Command
-
· 1 min, 194 words
Laravel 11: New Artisan "make:class" Command
-
Premium Course: How to Build Laravel 11 API From Scratch
-
· 7 mins, 1314 words
Laravel 11: Main New Features and Changes
-
· 1 min, 171 words
Laravel 11: How to Change Default SQLite to MySQL
-
· Updated Mar 2024 · 3 mins, 477 words
Caching in Laravel with Redis: Simple Example
-
· 5 mins, 890 words
Virtual DB Columns in Laravel Migrations and MySQL
-
· 2 mins, 291 words
CarbonImmutable Class: Why You Would Need It