2024-07-30 08:44:58 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
class Maintenance extends Model
|
|
|
|
{
|
|
|
|
use HasFactory;
|
2024-07-30 16:13:21 +00:00
|
|
|
|
|
|
|
protected $fillable = [
|
|
|
|
'name',
|
|
|
|
'description',
|
|
|
|
'schedule',
|
|
|
|
];
|
2024-07-31 15:04:33 +00:00
|
|
|
|
2024-08-06 09:02:45 +00:00
|
|
|
public function hosts()
|
2024-07-31 15:04:33 +00:00
|
|
|
{
|
2024-08-06 09:02:45 +00:00
|
|
|
return $this->belongsToMany(Host::class, "maintenance_host", "maintenance_id", "host_id" );
|
2024-07-31 15:04:33 +00:00
|
|
|
}
|
2024-07-31 16:45:14 +00:00
|
|
|
|
2024-08-06 09:02:45 +00:00
|
|
|
public function history()
|
2024-07-31 16:45:14 +00:00
|
|
|
{
|
2024-08-06 09:02:45 +00:00
|
|
|
return $this->hasMany(MaintenanceHistory::class);
|
2024-07-31 16:45:14 +00:00
|
|
|
}
|
2024-08-06 06:31:51 +00:00
|
|
|
|
|
|
|
public function tasks()
|
|
|
|
{
|
|
|
|
return $this->hasMany(MaintenanceTask::class,);
|
|
|
|
}
|
2024-07-30 08:44:58 +00:00
|
|
|
}
|