While implementing multiple languages, I face some issues with my Routes. Logically, Users can adjust languages within the footer, which will trigger the following Route
Route::get('/lang/{lang?}', function($lang=NULL){
App::setLocale($lang);
return view('home');
})->name('lang');
But if I need to add a collection of Partners or something similar on the homepage, I normally structure my routes this way:
Route::get('/', 'HomeController@index')->name('home');
// HomeController
public function index()
{
$partners = Partner::orderBy('created_at', 'desc')->get();
return view ('home', compact('partners'));
}
How can I add the partners Collection to the language route structure?
Could there be problems with a home redirect, because basically the home.blade.php Route is / and not /lang/{lang?}.