i am trying to use mcamara package for language translation but on the root url i am getting 404 error. Actually i am trying to detect the ip address of the user and then set the locale according to that country. i stored the locales and country names in the database. Below is my code:
AppServiceProvider.php in this file i am fetching user ip address through https://github.com/stevebauman/location this package and checking the locale from database and set the locale according to that.
$ip = request()->getClientIp();
$position = Location::get($ip);
$locale = Locale::where('country_code',strtolower($position->countryCode))->first();
if($locale){
LaravelLocalization::setLocale($locale->country_code);
}
Web.php
Route::group([
'prefix' => LaravelLocalization::getCurrentLocale(),
'middleware' => ['localizationRedirect', 'localeViewPath' ]], function(){
Route::get('/',function(){
dd('check');
});
}
i am getting 404 error.