|
|
<?php
namespace App\Models;
use App\Models\Model;
class Status extends Model { protected $table = 'statuses';
protected $fillable = [ 'business_id', 'workflow_id', 'name', 'state', 'order' ];
protected $reportable = [ 'name', 'state', 'order' ];
public function rules() { return [ 'name' =>'required|string|min:3|max:255', 'state' => 'nullable|between:0,3', 'order' => 'nullable|numeric|min:0' ]; }
public function getValueOf(?string $key) { $values = [ 'business_id' => $this->business_id, 'project_id' => null, 'sprint_id' => null, 'workflow_id' => $this->workflow_id, 'status_id' => $this->id, 'system_id' => null, 'user_id' => null, 'task_id' => null, 'subject_id' => $this->id, ];
if ($key && isset($values, $key)) { return $values[$key]; }
return $values; }
public function workflow() { return $this->belongsTo(Workflow::class,'workflow_id','id'); } }
|