Your IP : 216.73.216.79


Current Path : /var/www/html/dynaweb-cms-v1/app/Models/Backend/
Upload File :
Current File : /var/www/html/dynaweb-cms-v1/app/Models/Backend/ContentArticleTranslation.php

<?php

namespace App\Models\Backend;

use App\Models\Backend\ContentArticle;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Attributes\Table;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

#[Table('content_article_translation', key: 'article_translation_id')]
#[Fillable([
    'article_translation_parent_id',
    'article_translation_title',
    'article_translation_content',
    'article_translation_main',
    'article_translation_language',
    'created_by',
    'updated_by',
])]
class ContentArticleTranslation extends Model
{
    use HasFactory;

    protected function casts(): array
    {
        return [
            'article_translation_parent_id' => 'integer',
            'article_translation_main'       => 'integer',
            'created_by'                     => 'integer',
            'updated_by'                     => 'integer',
            'created_at'                     => 'datetime',
            'updated_at'                     => 'datetime',
        ];
    }

    /*
    |--------------------------------------------------------------------------
    | RELATIONSHIPS
    |--------------------------------------------------------------------------
    */

    public function article()
    {
        return $this->belongsTo(
            ContentArticle::class,
            'article_translation_parent_id',
            'article_id'
        );
    }
}