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, includingtitle
anddescription
. -
$table
(string): Specifies the database table name asblog_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';
}