equipment = $equipment; $this->tasks = OrderEquipmentTasks::where('equipment_id', $this->equipment->equipment_id) ->orderBy('execution_order', 'asc') ->get(); // Coletando todos os registros onde further_tasks_id é diferente de null $this->furtherTaskRecords = OrderEquipmentTasks::where('equipment_id', $this->equipment->equipment_id) ->whereNotNull('further_tasks_id') ->get(); // Coletando todos os further_tasks_id da coleção $tasks que são diferentes de null $existingFurtherTaskIds = $this->tasks->whereNotNull('further_tasks_id')->pluck('further_tasks_id'); // Buscando furtherTasks que não estão presentes em $tasks $this->furtherTasks = FurtherTasks::where('company_projects_id', $this->equipment->company_projects_id) ->whereNotIn('further_tasks_id', $existingFurtherTaskIds) ->get(); } public function toggle() { $this->showAdditionalTask = !$this->showAdditionalTask; } public function render() { return view('livewire.articulado.additonal-task'); } }