SmartCane/laravel_app/app/Models/ProjectDownload.php
guillaume91 cf5e2fea70 wip
2024-06-24 16:41:24 +02:00

35 lines
726 B
PHP

<?php
namespace App\Models;
use App\Events\ProjectDownloadStatus;
use App\Traits\HasStatus;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ProjectDownload extends Model
{
use HasFactory;
use HasStatus;
protected $fillable = [
'name',
'path',
'status'
];
public function project(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(Project::class);
}
protected static function booted(): void
{
parent::booted();
self::updated(function (ProjectDownload $projectDownload) {
event(new ProjectDownloadStatus($projectDownload));
});
}
}