Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Store data through Repository - Not working

    Modules
    2
    10
    2389
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      RK REZA last edited by

      I'm having trouble with this error -

      *Illuminate \ Contracts \ Container \BindingResolutionException
      Target [Webkul\Brand\Contracts\Brand] is not instantiable while building 
      [Webkul\Brand\Http\Controllers\BrandController].*
      

      I was trying to create new package. Using direct model & controller is fine and working but when I was trying repositories,contracts & proxies I get this error.

      [N.B : I implement the Brand (Contracts) in my Brand (Model)]

      1 Reply Last reply Reply Quote 0
      • R
        rahul last edited by

        Hi,

        Please make sure that you have created 'ModuleServiceProvider.php' file in your package & mentioned all of your model here. Like -

        <?php

        namespace Webkul\Attribute\Providers;

        use Konekt\Concord\BaseModuleServiceProvider;

        class ModuleServiceProvider extends BaseModuleServiceProvider
        {
        protected $models = [
        \Webkul\Attribute\Models\Attribute::class,
        ...
        ];
        }

        after doing it, in config folder you can see there is a 'concord.php' file, mention this provider there like -
        return [
        'modules' => [
        VendorA\ModuleX\Providers\ModuleServiceProvider::class,
        VendorB\ModuleY\Providers\ModuleServiceProvider::class
        ]
        ];

        for more reference, please see any of our package.

        Thanks
        Rahul Shukla

        1 Reply Last reply Reply Quote 0
        • R
          RK REZA last edited by

          Do I have to create "concord.php" in my newly created package?
          If so, then I already created "concord.php" and added modules but error still there. I was trying to use your Category module as reference.

          1 Reply Last reply Reply Quote 0
          • R
            rahul last edited by

            No, you don't need to create it, it will be in config folder, see there and do whatever i mentioned above.

            1 Reply Last reply Reply Quote 0
            • R
              RK REZA last edited by

              Capture.PNG

              Still getting error...

              Capture.PNG

              And the other problem is Whenever I run these commands

              php artisan config:clear
              php artisan cache:clear
              php artisan route:cache
              php artisan view:clear
              composer dump-autoload
              php artisan vendor:publish
              

              This error occurs

              Capture2.PNG

              Then command solves the error

              php artisan config:cache
              
              1 Reply Last reply Reply Quote 0
              • R
                rahul last edited by

                run 'php artisan migrate' to solve above error.

                1 Reply Last reply Reply Quote 0
                • R
                  RK REZA last edited by

                  It says Nothing to migrate.

                  1 Reply Last reply Reply Quote 0
                  • R
                    rahul last edited by

                    Make sure that you have implemented or extended contract on your model like -

                    <?php

                    namespace Webkul\Attribute\Models;

                    use Webkul\Core\Eloquent\TranslatableModel;
                    use Webkul\Attribute\Contracts\Attribute as AttributeContract;

                    class Attribute extends TranslatableModel implements AttributeContract
                    {

                    }

                    In the above example, you can see that Attribute model is implementing its contract AttributeContract and i think you are missing this.
                    after this please run -
                    php artisan config:clear
                    php artisan cache:clear
                    php artisan key:generate
                    composer dump-autoload

                    1 Reply Last reply Reply Quote 0
                    • R
                      RK REZA last edited by

                      Capture3.PNG

                      1 Reply Last reply Reply Quote 0
                      • R
                        RK REZA last edited by

                        Capture4.PNG

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post