2017 © Pedro Peláez
 

library translations

A simple Translation trait to be used with Laravel Models

image

larapages/translations

A simple Translation trait to be used with Laravel Models

  • Wednesday, June 13, 2018
  • by nickdekruijk
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Latest Stable Version Latest Unstable Version Monthly Downloads Total Downloads License, (*1)

Translations

A simple Translation trait to be used with Laravel Models. When this trait is enabled on your model you can user $model->__('column') or $model->trans('column') to get the translated value for your current locale., (*2)

Installation

To install the package use, (*3)

composer require nickdekruijk/translations, (*4)

Configuration

If you don't like the default configuration options publish the config file and change the translations.php file in your Laravel app/config folder., (*5)

php artisan vendor:publish --tag=config --provider="NickDeKruijk\Translations\ServiceProvider", (*6)

Usage

First off all your database table must include all columns for the translations. For example if you have a table with a title and a description column you must add a title_nl and description_nl column if you want do support Dutch (nl) translations. Add this to the use section of your model: use NickDeKruijk\Translations\Translations; And add use Translations; after, (*7)

class Story extends Model
{

Then you can use the trans or __ methods on your models. Like this: $story->trans('title') or $story->__('description'), (*8)

License

Translations is open-sourced software licensed under the MIT license., (*9)

The Versions

13/06 2018

dev-master

9999999-dev http://www.larapages.nl

A simple Translation trait to be used with Laravel Models

  Sources   Download

MIT

The Requires

 

by Nick de Kruijk

laravel php model translation localization

13/06 2018

1.0.0

1.0.0.0 http://www.larapages.nl

A simple Translation trait to be used with Laravel Models

  Sources   Download

MIT

The Requires

 

by Nick de Kruijk

laravel php model translation localization