2017 © Pedro PelĂĄez
 

library translation

Permet de gérer la traduction d'objets

image

oniti/translation

Permet de gérer la traduction d'objets

  • Tuesday, May 15, 2018
  • by fbouyer
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Translation

Installation

    composer require oniti/translation

The next required step is to add the service provider to config/app.php :, (*1)

    Oniti\Translation\TranslationServiceProvider::class,

Add middleware to app/Http/Kernel.php, (*2)

    protected $middlewareGroups = [
        ...
        'api' => [
            ....,
            \Oniti\Translation\middlewares\TranslationMiddleWare::class,
        ],
    ];

Publish

The last required step is to publish views and assets in your application with :, (*3)

    php artisan vendor:publish

Migrate

Migrate in order to create table:, (*4)

    php artisan migrate

Exemple

Configure Model, (*5)

    <?php

    namespace App;

    use Illuminate\Database\Eloquent\Model;
    use Oniti\Translation\Traits\Translate;

    class Article extends Model
    {
        use Translate;

        protected $translate = ['libelle'];
    }

    ?>

Route Test, (*6)

     Route::get('test', function(){
         $article = Article::first();
         // fill méthode
         $article->fill(['libelle' => ['fr' => 'Machin Test update', 'en'=> 'Test Machin English update']]);
         // classic methode
         $article->libelle = ['fr' => 'Machin Test hdhdhdhdh', 'en'=> 'Test Machin English hdhdhdhdh'];
         $article->save();

         return $article;

        // Creation methode
        // $article = Article::create(['libelle' => ['fr' => 'Machin Test', 'en'=> 'Test Machin English']]);

     });

The Versions

15/05 2018

dev-master

9999999-dev

Permet de gérer la traduction d'objets

  Sources   Download

MIT

The Requires

 

by Francois BOUYER