29 lines
646 B
PHP
29 lines
646 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Announcement extends Model
|
|
{
|
|
protected $table = 'announcements';
|
|
|
|
protected $fillable = [
|
|
'headline',
|
|
'content',
|
|
'enhancer_id'
|
|
];
|
|
|
|
public function enhancer(){
|
|
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
|
}
|
|
|
|
public function media()
|
|
{
|
|
return $this->belongsToMany(Media::class, 'announcements_media', 'announcement_id', 'media_id')
|
|
->using(AnnouncementMedia::class)
|
|
->withPivot(['status', 'category'])
|
|
->withTimestamps();
|
|
}
|
|
}
|