Bagisto Forum

    Bagisto

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

    How can override category observer in new package ?

    Modules
    2
    2
    124
    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.
    • Z
      zainawan99 last edited by

      How can override category observer?

      1 Reply Last reply Reply Quote 0
      • devansh-webkul
        devansh-webkul last edited by

        Hi @zainawan99,

        The mentioned class has been registered in the Category package provider's method. You can just change the class name there and then extend the one which you need the override.

        For e.g.,

        In packages/Webkul/Category/src/Providers/CategoryServiceProvider.php, you can do something like this,

        public function boot()
        {
            ...
        
            CategoryProxy::observe(YourObserver::class);
        
            ...
        }
        

        Then here,

        class YourObserver extends CategoryObserver
        { ... }
        

        Then afterwards, it's your choice whether you want to override or not.

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