Bagisto Forum

    Bagisto

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

    How to override product model?

    Knowledge Base
    3
    6
    954
    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.
    • L
      lwilliams-heli last edited by

      Hi,

      I've created a couple of new packages to extend the product admin section, however I can not seem to override the product model.

      I am just trying to add a new relationship.

      I have

      $this->app->concord->registerModel(
          ProductContract::class, Product::class
      );
      

      in my package service provider, but still not seeing the relationship.

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

        Hi,

        Please go through with following link -https://devdocs.bagisto.com/override-core-model.html.

        1 Reply Last reply Reply Quote 0
        • L
          lwilliams-heli last edited by

          Hi Rahul,

          That's exactly what I mentioned I had done in my original comment, yet it still would not work.

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

            In your package, create your model.
            In this model, extend that model to whom, you want to extend.

            <?php

            namespace App\Http;

            use Webkul\Product\Models\Product as ProductBaseModel;

            class Product extends ProductBaseModel
            {

            }

            In your service provider register your model with contract of model.

            $this->app->concord->registerModel(\Webkul\Product\Contracts\Product::class, \App\Http\Product::class);

            Thanks
            Rahul Shukla

            1 Reply Last reply Reply Quote 0
            • T
              trane294 last edited by

              This tutorial doesn't work for me as well. I did everything exactly like in tutorial

              1 Reply Last reply Reply Quote 0
              • T
                trane294 last edited by

                https://github.com/bagisto/bagisto/issues/1482

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