I'm moving my working project to laravel. In order process i'm using SSL Certificate.
cart, orderAddress, orderPayment, orderResults are four steps of Order Process.
My first question is "What is best practice to disable ssl certificate in localhost ?"
If mine is good (in below) "How can i shorten this code ?" Because i'm repeating myself that's why i didn't like.
/**
* Disable ssl in Localhost
*/
if (App::environment('local')) {
Route::get('/cart', [
'uses' => 'CartController@index',
'as' => 'cart',
]);
Route::get('/orderAddress', [
'uses' => 'AddressController@orderIndex',
'as' => 'orderAddress',
]);
Route::get('/orderPayment', [
'uses' => 'PaymentController@orderPayment',
'as' => 'orderPayment',
]);
Route::get('/orderResult', [
'uses' => 'OrderController@orderResult',
'as' => 'orderResult',
]);
} else {
/**
* SSL PAGES
*/
Route::group(['before' => 'force.ssl'], function()
{
Route::get('/cart', [
'uses' => 'CartController@index',
'as' => 'cart',
]);
Route::get('/orderAddress', [
'uses' => 'AddressController@orderIndex',
'as' => 'orderAddress',
]);
Route::get('/orderPayment', [
'uses' => 'PaymentController@orderPayment',
'as' => 'orderPayment',
]);
Route::get('/orderResult', [
'uses' => 'OrderController@orderResult',
'as' => 'orderResult',
]);
});
Route::filter('force.ssl', function()
{
if( ! Request::secure())
{
return Redirect::secure(Request::path());
}
});