VS Code is a powerful and versatile code editor that can be customized to enhance your development experience as a Laravel developer. Here are my favorite settings:
Open the settings.json
file in VS Code by pressing Ctrl + ,
or Cmd + ,
.
VS Code is a powerful and versatile code editor that can be customized to enhance your development experience as a Laravel developer. Here are my favorite settings:
Open the settings.json
file in VS Code by pressing Ctrl + ,
or Cmd + ,
.
If an item lacks a TTL setting and is not in use, it will persist in the storage indefinitely unless deleted.
Run this command to delete stale items inside redis-cli:
eval "for _,k in ipairs(redis.call('keys', '*')) do if redis.call('object', 'idletime', k) > {SECONDS} then redis.call('expire', k, 1) end end" 0
In a Git repository, how to properly rename a directory/file name already pushed?
Normally, simply renaming a directory or file name does not reflect in the remote repository.
Syntax:
git mv casesensitive tmp
git mv tmp CaseSensitive
Soketi defaults to app-id, app-key, and app-secret after configuring broadcasting environment variables in the.env file. To use our own values, we should define them in docker-compose.yml
as follows:
soketi:
image: "quay.io/soketi/soketi:latest-16-alpine"
environment:
SOKETI_DEBUG: "1"
Laravel provides excellent support for email sending. Sometimes you need to record the status of outgoing emails in the system. You must construct two tables: email_logs
and email_log_statuses
. The 'email_logs' table contains all outgoing emails, while the email_log_statuses
table contains all email statuses such as sent, failed, queued, scheduled to send, and so on.
Now, create Event Listeners During the email-sending process, Laravel triggers multiple events. You can set up event listeners to record these events and update the email log accordingly.
php artisan make:listener SendEmailListener --event='Illuminate\Mail\Events\MessageSending'
php artisan make:listener SentEmailListener --event='Illuminate\Mail\Events\MessageSent'
php artisan make:listener FailedEmailListener --event='Illuminate\Mail\Events\MessageFailed'
Ensuring the security of user sessions is critical in web applications, and Laravel Sanctum offers a strong solution for API authentication in Laravel projects. Implementing an automatic logout function when users are idle for an extended length of time is critical for improving security and user privacy. In this post, we'll look at how to integrate idle timeout capabilities with the Laravel API using Sanctum. Let's look at how to set up automated user logout for inactive sessions in a Laravel Sanctum-powered API.
Open AuthServiceProvider.php
and add this code accordingly to this file:
use Carbon\Carbon;