1. Go to this page and download the library: Download codewiser/polyglot 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/ */
codewiser / polyglot example snippets
/**
* Register the Polyglot gate.
*
* This gate determines who can access Polyglot in non-local environments.
*
* @return void
*/
protected function gate()
{
Gate::define('viewPolyglot', function ($user) {
return in_array($user->email, [
'[email protected]',
]);
});
}
class AcceptLanguage
{
public function handle(Request $request, Closure $next)
{
app()->setLocale($request->getPreferredLanguage(Polyglot::getLocales()));
return $next($request);
}
}