PHP code example of syscover / langlocale
1. Go to this page and download the library: Download syscover/langlocale library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
syscover / langlocale example snippets
php artisan vendor:publish --provider="Syscover\NavTools\NavToolsServiceProvider"
'pulsar.navTools' => \Syscover\NavTools\Middleware\NavTools::class,
Route::group(['middleware' => ['pulsar.navTools']], function() {
// write here your routes
});
Route::group(['middleware' => ['pulsar.navTools']], function() {
Route::get('/', function(){ return view('www.index'); });
Route::get('{lang}', function(){ return view('www.index'); });
Route::post('{lang}/contact', ['as'=>'contact', 'uses'=>'FrontEndController@contact']);
});
Route::group(['middleware' => ['pulsar.navTools']], function() {
Route::get('/', function(){ return view('www.index'); });
Route::get('en', function(){ return view('www.index'); });
Route::get('es', function(){ return view('www.index'); });
Route::post('en/contact', ['as' => 'contact-en', 'uses'=>'FrontEndController@contact']);
Route::post('es/contacto', ['as' => 'contact-es', 'uses'=>'FrontEndController@contact']);
});
Route::group(['middleware' => ['pulsar.navTools']], function() {
Route::get('/', function(){ return view('www.index'); });
Route::get('/en-{country}', function(){ return view('www.index'); });
Route::get('/es-{country}', function(){ return view('www.index'); });
Route::post('en-{country}'/contact', ['as' => 'contact-en', 'uses'=>'FrontEndController@contact']);
Route::post('es-{country}'/contacto', ['as' => 'contact-es', 'uses'=>'FrontEndController@contact']);
});
Route::group(['middleware' => ['pulsar.navTools']], function() {
Route::get('/', function(){ return view('www.index'); });
Route::get('/{lang}-{country}', function(){ return view('www.index'); });
Route::post('/{lang}-{country}/contact', ['as' => 'contact-en', 'uses'=>'FrontEndController@contact']);
});
change_language('en');
change_country('us');