simedkom/app/Models/Cooperation.php
2025-03-10 11:21:03 +07:00

36 lines
826 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');
}
}