public function getSingleNews($slug)
{
$tags = Tag::all();
$categories = Category::all();
$post = Post::where('slug', '=', $slug)->first();
return view('website.detail', compact('post', 'tags', 'categories'));
}
$defaultLocale = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
но этот вариант не работает для Chrome - работает для Safari dd($defaultLocale); - "ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7"
"ru"
@yield('')
в секцию head public function handle(Request $request, Closure $next)
{
if ((new Agent)->robot() == 'Yandex' or $request->input('turbo') == 'true') {
return $next($request);
}
return response()->view('layouts.zaglushka');
}
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'robot' => \App\Http\Middleware\isRobot::class,
];
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\App\Http\Middleware\isRobot::class,
],
Route::group(['namespace' => 'Site', 'middleware' =>'web'], function() {
// Base websites Urls
Route::get('/', 'HomeController@index')->name('home');
Route::get('/route2', 'HomeController@route2')->name('route2');
// Redirects
Route::get('/route3', 'RedirectController@index');
Route::get('/download', 'RedirectController@download');
});