*/ public function toArray(Request $request): array { $projecName=$this->object_type==ApprovalFlowType::TASK->value?null:Project::query()->where('id',$this->object_id)->first(); return [ 'id' => $this->id, 'name' => $this->name, 'type' => $this->type, 'object_type' => $this->object_type, 'object_id' => $this->object_id==0?null:$this->object_id, 'link_project'=>$projecName==null?null:$projecName->name, 'created_at' => (string)$this->created_at, 'created_by' => new UserProfileResource($this->createdBy), 'display_id' =>$this->display_id, ]; } }