/** * Finds a product type by id. * * @param int $id * @param bool $with_attributes * @return ProductType * @throws ModelNotFoundException */ public function findById($id, $with_attributes = false) { return $with_attributes ? ProductType::with('attributes')->findOrFail($id) : ProductType::findOrFail($id); }