Download the PHP package geeksdevelop/translate without Composer
On this page you can find all versions of the php package geeksdevelop/translate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download geeksdevelop/translate
More information about geeksdevelop/translate
Files in geeksdevelop/translate
Package translate
Short Description Package for handling translations of data in the database
License MIT
Informations about the package translate
Laravel Translate Data
Compatible with laravel versions 5.1, 5.2, 5.3 and 5.4
Package for the translation of fields in the database according to the language of configuration of the laravel system.
Installation
Service Provider
Add the package to your application service providers in config/app.php
file.
Publish
Publish the migration to your application. Run these commands inside your terminal.
Migrate the tables
Run migrations.
Include trait to models
Include the Translate
feature within your models where you need to translate fields.
User Guide
Create translations
Create the translation by placing the following data
locale
=> language to translate,
type
=> Input name to translate,
value
=> string incresada ene the input,
Exemple
Get the translation
To get a translation we just have to make use of the method translate()
, which by entering the type will give us the translation depending on the language in which the laravel system is configurated.
If you want to get a specific translation in a language other than the one that is configured laravel you can use the translate ()
method, in the following way:
Using translate()
, we can get all the translations that have been registered on the model in different languages.
Update translations
To update, the method to be used is updateTranslate(locale, type, value)
Delete translation
To delete just use the method deleteTranslate(locale, type)