Laravel Mail setting Redis

The basics of Laravel Queues using Redis and Horizon https://voltagead.com/the-basics-of-laravel-queues-using-redis-and-horizon/

I’ll use mailtrap for this. If you haven’t used mailtrap, you can sign up for a free account.

Once logged in, you’ll copy your username and password over to the Laravel .env file as MAIL_USERNAME and MAIL_PASSWORD.

Laravel Eloquent usage > Eager loading relationships

$orders = \App\Order::with(‘user’)->get();

foreach($orders as $order){
echo $order->user->first_name;
}

The above code will execute two database queries. One to retrieve all the orders and the second to retrieve all the users tied to the orders. If you have 1000 order records, your application still executes just two queries.

Since we need only the user’s first name, we can choose to eager load it like this:

$orders = \App\Order::with(‘user:id,name’)->get();

foreach($orders as $order){
echo $order->user->first_name;
}

Advanced Laravel Eloquent usage https://blog.pusher.com/advanced-laravel-eloquent-usage/