Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Hossam1Hamed opened this issue Jan 15, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@Hossam1Hamed
Copy link

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▕

@ghermans ghermans added the bug Something isn't working label Jan 15, 2023
@DonxDaniyar
Copy link

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

@Jackyhelloboy
Copy link

Please share the code

@DonxDaniyar
Copy link

Please share the code

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants