40 lines
935 B
PHP
40 lines
935 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Cooperation extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'cooperations';
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'start_date',
|
|
'end_date',
|
|
'banner',
|
|
'offer_file_template',
|
|
'description',
|
|
'enhancer_id',
|
|
];
|
|
|
|
public function media()
|
|
{
|
|
return $this->belongsToMany(Media::class, 'media_cooperations', 'cooperation_id', 'media_id')
|
|
->using(MediaCooperation::class)
|
|
->withPivot(['status', 'rejection_reason'])
|
|
->withTimestamps();
|
|
}
|
|
|
|
public function proposals(){
|
|
return $this->hasMany(CooperationProposal::class, 'cooperation_id', 'id');
|
|
}
|
|
|
|
public function mediaOrder(){
|
|
return $this->hasOne(Order::class, 'cooperation_id', 'id');
|
|
}
|
|
}
|