main

filamentphp/demo

Last updated at: 29/12/2023 09:42

Link.php

TLDR

This file defines a model class Link for the blog_links table in the database. The Link model has translations for the title and description attributes.

Classes

Link

The Link class extends the Model class and represents a row in the blog_links table. It uses the HasFactory trait for generating model factories and supports translations using the HasTranslations trait. The Link model has the following attributes:

  • translatable (array): Specifies the attributes that should be translated, including title and description.
  • $table (string): Specifies the database table name as blog_links.
<?php

namespace App\Models\Blog;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Spatie\Translatable\HasTranslations;

class Link extends Model
{
    use HasFactory;
    use HasTranslations;

    public $translatable = [
        'title',
        'description',
    ];

    protected $table = 'blog_links';
}