2017 © Pedro Peláez
 

library laravel-db-language

Laravel command to add language fields on database

image

makth/laravel-db-language

Laravel command to add language fields on database

  • Thursday, October 5, 2017
  • by MakisThomas
  • Repository
  • 1 Watchers
  • 0 Stars
  • 26 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Laravel DB Language

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., (*1)

Installing

First, pull in the package through Composer., (*2)

composer require makth/laravel-db-language 

or, (*3)

"require":{
    "makth/laravel-db-language": "2.0"
}

Next, open config/app.php, and include service provider., (*4)

'providers' => [
    Makth\DbLanguage\DbLanguageServiceProvider::class,
];

And, for convenience, add a facade alias to the same file at the bottom:, (*5)

'aliases' => [
    'Lang' => Makth\DbLanguage\Facade\Lang::class,
];

Usage

Add a language

php artisan language:add German

Remove a language

php artisan language:remove German

Default language

You can set your default language using option --default. For example:, (*6)

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., (*7)

Config

You can publish config file lang.php, and set your default language there., (*8)

php artisan vendor:publish --tag=config

Language Field

You can have form fields with multiple languages., (*9)

Step 1

Export css files to public folder., (*10)

php artisan vendor:publish --tag=flags

Step 2

Add in your blade file, on head tag:, (*11)

@include('lang::style')

And at the bottom of the body:, (*12)

@include('lang::script')

And now you can get the form field with all installed languages like this:, (*13)

{{ 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.
  • the third parameter is an array with languages values.
  • the fourth parameter used to sets manual the default language.
  • the fifth parameter is an array with extra attributes for the fields.

For form fields used twitter bootstrap, and for the flags this package., (*14)

Authors

  • Makis Thomas

License

This project is licensed under the MIT License - see the LICENSE.md file for details., (*15)

The Versions

05/10 2017

dev-master

9999999-dev

Laravel command to add language fields on database

  Sources   Download

MIT

The Requires

 

by Makis Thomas

laravel language database language

05/10 2017

2.0

2.0.0.0

Laravel command to add language fields on database

  Sources   Download

MIT

The Requires

 

by Makis Thomas

laravel language database language

15/08 2017

1.0.11

1.0.11.0

Laravel command to add language fields on database

  Sources   Download

MIT

The Requires

 

by Makis Thomas

laravel language database language