79628589

Date: 2025-05-19 10:54:54
Score: 1
Natty:
Report link

Call to undefined method App\Http\Controllers\ProductController::middleware()

class ProductController extends Controller
{
    public function __construct(protected ProductService $productService)
    {
        $this->productService = $productService;

        $this->middleware(['permission:product-create'], ['only' => ['create', 'store']]);
    }

In this case just use below mentioned Extends

class ProductController extends \Illuminate\Routing\Controller
{
    public function __construct(protected ProductService $productService)
    {
        $this->productService = $productService;

        $this->middleware(['permission:product-create'], ['only' => ['create', 'store']]);
    }
Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Zhine S