bagisto / bagisto-reward-points

The Laravel eCommerce Reward Points module allows the admin to reward its customers with points
https://bit.ly/3zUlsgr
MIT License
6 stars 5 forks source link

confilct between cart model in bagisto-reward-points and cart model in Webkul\Checkout #1

Open Hossam1Hamed opened 1 year ago

Hossam1Hamed commented 1 year ago

Declaration of Webkul\Rewards\Models\Cart::items() must be compatible with Webkul\Checkout\Models\Cart::items(): Illuminate\Database\Eloquent\Relations\HasMany in /var/www/vhosts/hqol.store/httpdocs/vendor/bagisto/bagisto-reward-points/src/Models/Cart.php on line 33

Symfony\Component\ErrorHandler\Error\FatalError

Declaration of Webkul\Rewards\Models\Cart::items() must be compatible with Webkul\Checkout\Models\Cart::items(): Illuminate\Database\Eloquent\Relations\HasMany

at vendor/bagisto/bagisto-reward-points/src/Models/Cart.php:33 29▕ 30▕ / 31▕ To get relevant associated items with the cart instance 32▕ / ➜ 33▕ public function items() { 34▕ return $this->hasMany(CartItemProxy::modelClass())->whereNull('parent_id'); 35▕ } 36▕ 37▕ /

Whoops\Exception\ErrorException

Declaration of Webkul\Rewards\Models\Cart::items() must be compatible with Webkul\Checkout\Models\Cart::items(): Illuminate\Database\Eloquent\Relations\HasMany

at vendor/bagisto/bagisto-reward-points/src/Models/Cart.php:33 29▕ 30▕ /* 31▕ To get relevant associated items with the cart instance 32▕ */ ➜ 33▕ public function items() { 34▕ return $this->hasMany(CartItemProxy::modelClass())->whereNull('parent_id'); 35▕ } 36▕ 37▕

DonxDaniyar commented 1 year ago

I solve this issue by adding return types into each metod that overrides in Reward Cart class

Jackyhelloboy commented 7 months ago

Please share the code

DonxDaniyar commented 6 months ago

Please share the code

You can take it from here https://github.com/bagisto/bagisto-reward-points/pull/2/files