%PDF- %PDF-
Mini Shell

Mini Shell

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

<?php

namespace App\Models;

class Article extends BaseModel
{
    const MIKRO_CATEGORY   = 'MIKRO';
    const MAKRO_CATEGORY   = 'MAKRO';
    const MEDIA_COLLECTION = 'articles';

    protected $fillable = [
        'title',
        'description',
        'category',
        'session',
    ];

    public function authors()
    {
        return $this->belongsToMany(Author::class);
    }

    public function keyWords()
    {
        return $this->belongsToMany(KeyWord::class, 'article_key', 'article_id', 'key_id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\MorphOne
     */
    public function media()
    {
        return $this->morphOne(Media::class, 'model');
    }

    public function getAuthorsIds()
    {
        $ids = $this->authors()->pluck('author_id')->toArray();
        return implode(',', $ids);
    }

}

Zerion Mini Shell 1.0