Translatable columns

Submitted by a7medKhalid - 5 months ago

Translatable Pro is designed for performance, storing phrases in separate database tables to simplify the maintenance of translations across all languages. With just one Composer install, you can seamlessly integrate comprehensive multi-language support into your app, enabling you to create advanced, optimized, and high-performance translatable applications with an efficient database structure.

class Book extends Model
{
    use HasFactory;
    use HasPhrases;

    protected $guarded = [];

    protected $casts = [
        'title' => PhrasesCast::class,
        'desc' => PhrasesCast::class,
    ];

    public function chapters(): HasMany
    {
        return $this->hasMany(Chapter::class);
    }

    public function cat(): BelongsTo
    {
        return $this->belongsTo(Category::class);
    }

    public function meta(): HasOne
    {
        return $this->hasOne(Meta::class);
    }
}