Package Data | |
---|---|
Maintainer Username: | MakisThomas |
Maintainer Contact: | naoythoma@hotmail.com (Makis Thomas) |
Package Create Date: | 2017-08-15 |
Package Last Update: | 2017-10-05 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-30 15:03:14 |
Package Statistics | |
---|---|
Total Downloads: | 36 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
This package gives you an easy way to generate automatically all language fields on database, using Laravel 5 command. If you have on database fields like body_en
and you want to create new like body_it
you can use this package to create it.
First, pull in the package through Composer.
composer require makth/laravel-db-language
or
"require":{
"makth/laravel-db-language": "2.0"
}
Next, open config/app.php
, and include service provider.
'providers' => [
Makth\DbLanguage\DbLanguageServiceProvider::class,
];
And, for convenience, add a facade alias to the same file at the bottom:
'aliases' => [
'Lang' => Makth\DbLanguage\Facade\Lang::class,
];
php artisan language:add German
php artisan language:remove German
You can set your default language using option --default
. For example:
php artisan language:add German --default="English"
If you want to have more than one languages, you set your main (already installed) language as default, and you add the other languages.
You can publish config file lang.php
, and set your default language there.
php artisan vendor:publish --tag=config
You can have form fields with multiple languages.
Export css files to public folder.
php artisan vendor:publish --tag=flags
Add in your blade file, on head tag:
@include('lang::style')
And at the bottom of the body:
@include('lang::script')
And now you can get the form field with all installed languages like this:
{{ Lang::fields(
'table_name',
'field_name',
['first_language_value', 'second_language_value'],
null,
['placeholder' => 'Name', 'required' => 'required']
)
}}
table_name
: the name of the db table.field_name
: the name of table field, without language extension.For form fields used twitter bootstrap, and for the flags this package.
This project is licensed under the MIT License - see the LICENSE.md file for details.