38 lines
913 B
PHP
38 lines
913 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class CooperationProposal extends Model
|
|
{
|
|
|
|
protected $table = 'cooperation_proposals';
|
|
|
|
protected $fillable = [
|
|
'attachment',
|
|
'status',
|
|
'e_catalog',
|
|
'description',
|
|
'rejection_reason',
|
|
'cooperation_id',
|
|
'media_id',
|
|
];
|
|
|
|
public function media(){
|
|
return $this->belongsTo(Media::class, 'media_id', 'id');
|
|
}
|
|
|
|
public function cooperation(){
|
|
return $this->belongsTo(Cooperation::class, 'cooperation_id', 'id');
|
|
}
|
|
|
|
public function journalists()
|
|
{
|
|
return $this->belongsToMany(Journalist::class, 'journalists_cooperation_proposals', 'cooperation_proposal_id', 'journalist_id')
|
|
->using(JournalistCooperationProposal::class)
|
|
->withTimestamps();
|
|
}
|
|
}
|