PHP code example of koenhoeijmakers / laravel-translatable
1. Go to this page and download the library: Download koenhoeijmakers/laravel-translatable library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
koenhoeijmakers / laravel-translatable example snippets
Schema::create('animals', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
});
use Illuminate\Database\Eloquent\Model;
use KoenHoeijmakers\LaravelTranslatable\HasTranslations;
class Animal extends Model
{
use HasTranslations;
protected $translatable = ['name'];
protected $fillable = ['name'];
}
use Illuminate\Database\Eloquent\Model;
class AnimalTranslation extends Model
{
protected $fillable = ['name'];
}