public function instruction($thread, $all = false) { $instruction = Instruction::with('instruction_type')->where('thread', $thread); if ($all) { $instruction = $instruction->where('active_from', '<=', date('Y-m-d H:i:s')); } $instruction = $instruction->get(); return response()->json($instruction); }