You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

66 lines
1.3 KiB

<?php
namespace App\Models;
use App\Models\Model;
class System extends Model
{
protected $table = 'systems';
protected $fillable = ['business_id', 'project_id', 'name'];
protected $reportable = [
'name'
];
public function rules()
{
return [
'name' => 'required|string|min:2|max:225',
];
}
protected $casts = [
'private' => 'boolean'
];
public function getValueOf(?string $key)
{
$values = [
'business_id' => $this->business_id,
'project_id' => $this->project_id,
'sprint_id' => null,
'workflow_id' => null,
'status_id' => null,
'system_id' => $this->id,
'user_id' => null,
'task_id' => null,
'subject_id' => $this->id,
];
if ($key && isset($values, $key)) {
return $values[$key];
}
return $values;
}
public function business()
{
return $this->belongsTo(Business::class, 'business_id', 'id');
}
public function project()
{
return $this->belongsTo(Project::class, 'project_id', 'id');
}
public function tasks()
{
return $this->hasMany(Task::class, 'sub_project_id', 'id');
}
}