1. Go to this page and download the library: Download kolirt/laravel-translations 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/ */
kolirt / laravel-translations example snippets
$query->withoutGlobalScope('translatable');
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Kolirt\Translations\Traits\Translatable;
class Tag extends Model
{
use Translatable;
protected $fillable = ['name', 'slug', 'description', 'sort_order', 'active'];
protected $translatable = ['name', 'slug', 'description' => 'text'];
}
$tag = Tag::first();
$tag->name;
// OR
$tag = Tag::first();
$tag->translation('name');