employee()->value('matricule'); if ($employeeMatricule === null) { return false; } $matriculeValue = $employeeMatricule instanceof Matricule ? $employeeMatricule->value : (string) $employeeMatricule; return Order::query() ->where('id', (string) $order->id) ->where('employee_matricule', $matriculeValue) ->exists(); } }