Package Data | |
---|---|
Maintainer Username: | mikehins |
Maintainer Contact: | me@mikehins.com (Mike Hins) |
Package Create Date: | 2017-09-06 |
Package Last Update: | 2020-03-05 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-02-06 03:01:45 |
Package Statistics | |
---|---|
Total Downloads: | 828 |
Monthly Downloads: | 1 |
Daily Downloads: | 0 |
Total Stars: | 6 |
Total Watchers: | 3 |
Total Forks: | 1 |
Total Open Issues: | 2 |
Create a language switcher for your Laravel 5.5+ app straight from the command line
composer require mikehins/language-switcher
This command will add / remove a language switcher menu item in the main nav bar.
Be sure to run php artisan make:auth
and php artisan migrate
before to run the command
To add the language switcher
php artisan switch:add
To revert the changes
php artisan switch:delete
This is what the command switch:add
does :
default_language
field in your users tablelayouts/app.blade.php
fileroutes/web.php
fileapp\Http\Middleware
app\Http\Kernel.php
app\Http\Controllers
directoryconfig/languages.php
When the user switch the language, it will automatically update the default_language
field from the users table.
The next time the user logs in, the language session will automatically be set by the middleware using the auth()->user()->default_language
variable.