2021-07-24 14:20:56 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
2023-08-14 09:23:39 +00:00
|
|
|
use App\Enums\Projects\ProjectStatusEnum;
|
2021-07-24 14:20:56 +02:00
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
2023-08-14 09:23:39 +00:00
|
|
|
/**
|
|
|
|
|
* @property string $name
|
|
|
|
|
* @property ProjectStatusEnum $status
|
|
|
|
|
* @property Site $site_id
|
|
|
|
|
*/
|
2021-07-24 14:20:56 +02:00
|
|
|
class Project extends Model
|
|
|
|
|
{
|
|
|
|
|
use HasFactory;
|
|
|
|
|
|
2022-04-26 12:15:31 +02:00
|
|
|
/**
|
|
|
|
|
* The attributes that are mass assignable.
|
|
|
|
|
*
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
2021-07-25 19:11:33 +02:00
|
|
|
protected $fillable = [
|
2023-08-14 09:23:39 +00:00
|
|
|
'name',
|
|
|
|
|
'status',
|
|
|
|
|
'site_id'
|
2021-07-25 19:11:33 +02:00
|
|
|
];
|
2021-07-24 14:20:56 +02:00
|
|
|
|
2022-04-26 12:15:31 +02:00
|
|
|
/**
|
2023-08-14 09:23:39 +00:00
|
|
|
* The attributes that should be cast to native types.
|
2022-04-26 12:15:31 +02:00
|
|
|
*
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
2023-08-14 09:23:39 +00:00
|
|
|
protected $casts = [
|
|
|
|
|
'status' => ProjectStatusEnum::class
|
2022-04-26 12:15:31 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// * RELATIONSHIPS.
|
|
|
|
|
|
|
|
|
|
/**
|
2022-08-30 06:41:39 +00:00
|
|
|
* BelongsTo Site
|
2022-04-26 12:15:31 +02:00
|
|
|
*
|
2022-08-30 06:41:39 +00:00
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
2022-04-26 12:15:31 +02:00
|
|
|
*/
|
2022-08-30 06:41:39 +00:00
|
|
|
public function site()
|
2021-07-25 19:11:33 +02:00
|
|
|
{
|
2022-08-30 06:41:39 +00:00
|
|
|
return $this->belongsTo(Site::class);
|
2021-07-25 19:11:33 +02:00
|
|
|
}
|
2021-07-24 14:20:56 +02:00
|
|
|
}
|