%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/news/app/Models/
Upload File :
Create Path :
Current File : /var/www/html/news/app/Models/Article.php

<?php

namespace App\Models;

use Laracodes\Presenter\Traits\Presentable;

class Article extends BaseModel
{
    use Presentable;

    protected $presenter = ArticlePresenter::class;

    protected $fillable = [
        'title',
        'description',
        'content',
        'number_of_views',
        'creator_id',
        'last_modifier_id',
        'category_id',
        'is_featured'
    ];

    protected $casts = [
        'id'               => 'integer',
        'title'            => 'string',
        'description'      => 'string',
        'content'          => 'string',
        'number_of_views'  => 'integer',
        'creator_id'       => 'integer',
        'last_modifier_id' => 'integer',
        'category_id'      => 'integer',
        'is_featured'      => 'boolean'
    ];

    protected $dates = [

    ];

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

    public function creator()
    {
        return $this->belongsTo(User::class, 'creator_id');
    }

    public function lastModifier()
    {
        return $this->belongsTo(User::class, 'last_modifier_id');
    }

    public function tags()
    {
        return $this->belongsToMany(Tag::class);
    }

    public function comments()
    {
        return $this->hasMany(Comment::class);
    }
}

Zerion Mini Shell 1.0