Wallogit.com
2017 © Pedro Peláez
Laravel Https is middleware to force us to access Secure HTTP requests.
Laravel Https is middleware to force us into Secure HTTP requests., (*2)
From your projects root folder in terminal run:, (*3)
composer require novay/laravel-https
Register the package, (*4)
Laravel 5.5 and up
Uses package auto discovery feature, no need to edit the config/app.php file., (*5)
Laravel 5.4 and below
Register the package with laravel in config/app.php under providers with the following:, (*6)
'providers' => [
...
Novay\ForceHttps\ForceHttpsServiceProvider::class,
];
Optionally publish the packages views, config file, and language files by running the following from your projects root folder:, (*7)
php artisan vendor:publish --tag=laravel-https
Add the middleware to your routes or controller. See Usage., (*8)
laravel-https can be configured in directly in /config/laravel-https.php if you published the assets.
Or you can variables to your .env file., (*9)
https in a route groups or on individual routes. Route::group(['middleware' => ['https']], function () {
Route::get('/', 'WelcomeController@welcome');
});
Route::get('/', 'WelcomeController@welcome')->middleware('https');
https in the contructor of your controller file. /**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('https');
}
Laravel-Https is licensed under the MIT license. Enjoy!, (*10)