How to create new Controller in Packages/Webkul/Shop



  • I want to customize the theme and wanted to create a new controller in Packages/Webkul/Shop folder. please tell me the suitable answers



  • Hi @Rakhi123
    If you want to crete your custome controller then you can make controllers Here and create routes Here.
    And if you want to create a new theme or ovrride the default theme then please follow this Doc



  • It has only the option to customize the existing controller. But I need to create my Own controller like a new controller.php file in the same location.
    whenever I create a controller using php artisan then it creates the controller in Public folder but I want to create the Controller in Packages/Webkul/Shop.
    Is it possibe?



  • @Rakhi123
    Please take a reference form Here



  • It is creating structure in this way. It is making 'Shop' folder inside controller
    C:\xampp\htdocs\bagisto-real\packages/Webkul/Shop//src/Http/Controllers/Shop/ShopTestController.php

    but I want like this
    C:\xampp\htdocs\bagisto-real\packages/Webkul/Shop//src/Http/Controllers/ShopTestController.php

    is there any method to create controller in package?



  • @Rakhi123
    Please check your namespace I guess something is missing in your namespace
    Or you can copy any controller from the shop package and change the namespace of the controller accordingly



  • My main need is to create a testcontroller in all the package folders like I want to create a controller in packages/Webkul/Shop//src/Http/Controllers/ShopTestController.php

    or

    packages/Webkul/Product//src/Http/Controllers/ProductTestController.php

    any method like package make:controller???



  • Hi there,
    Please use this command for the same.

    php artisan package:make-shop-controller ShopTestController ACME/TestPackage

Log in to reply