orderBy on relationship

Sometimes you will need to order the eloquent results based on a relationship for example posts and categgories. Here are different ways to do so based on this laravel daily video : https://www.youtube.com/watch?v=lRi1-RYnQ7A

Force https for pagination

sometimes the https works normally, but the pagination links fire http instead https, so the solution is to use setPath('') on the collection as follows :

how to generate random passwords in laravel

this snippet will teach you how to generate random passwords in laravel through laravel helper functions

Get unique values from multi-dimensional array

Sometimes you have a multi-dimensional array and you only need the unique arrays in it. here is a simple solution using pure php function

remove remote from github

this snippet will provide you with a remove remote snippet to remove remote url from github

Laravel eloquent multiple WHERE with multiple OR AND

this snippet will provide you code examples of how to use multiple where conditions with multiple or conditions or and conditions

Force https on laravel application

If you have purchased a SSl certificate for your website and then you website is still serving the assets from an HTTP protocol instead of https, and also the form and redirects are going to http instead of https, then here is the way to fix this from within laravel AppServiceProvide.

export data to pdf in laravel using domPDF package

this snippet will help you to get started with domPDF package for laravel to export your data in pdf format

Solution for removing password authentication on github

In 13 august 2021 , github removed password authentication so when you push to github you will face a problem here is the solution

set from email dynamically when sending mails in laravel

this snippet will teach you how to set different FROM EMAIL which exists in database to use as sender email when sending emails in laravel