Laravel - Middleware - Sorting Middleware

Rarely, you may need your middleware to execute in a specific order but not have control over their order when they are assigned to the route. In this case, you may specify your middleware priority using the $middlewarePriority property of your app/Http/Kernel.php file. This property may not exist in your HTTP kernel by default. If it does not exist, you may copy its default definition below:

 * The priority-sorted list of middleware.
 * This forces non-global middleware to always be in the given order.
 * @var array
protected $middlewarePriority = [