• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Register
  • Login
Bagisto Forum

Bagisto

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

How to override product model?

Knowledge Base
3
6
981
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 10 Jun 2019, 09:26

    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 11 Jun 2019, 09:01

      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 14 Jun 2019, 14:15

        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 17 Jun 2019, 08:00

          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
          • 3 months later
          • T
            trane294 last edited by 19 Sept 2019, 03:17

            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 19 Sept 2019, 03:26

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

              1 Reply Last reply Reply Quote 0
              3 out of 6
              • First post
                3/6
                Last post