Support the ongoing development of Laravel.io →
Packages Eloquent Configuration

some packages comes pre-packed with its own models ex.Cart but sometimes i want to add some extra logic to that model,

so instead of editing the original model or searching everywhere where this model was used and replace it with the newly created one,

i thought i would use app bind ex.

  • model

namespace App\Binders;

use some\package\Models\Cart;

class CartBinder extends Cart { // extra logic }

  • AppServiceProvider@register

$this->app->bind('some\package\Models\Cart', 'App\Binders\CartBinder');

SOF

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

muah muah muah Joined 17 Aug 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.