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

Fix wrong User type in buyableByUser method #47

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Models/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
use EscolaLms\Cart\Database\Factories\ProductFactory;
use EscolaLms\Cart\Models\Contracts\ProductInterface;
use EscolaLms\Cart\Models\Contracts\ProductTrait;
use EscolaLms\Cart\Models\User;
use EscolaLms\Cart\QueryBuilders\ProductModelQueryBuilder;
use EscolaLms\Cart\Services\Contracts\ProductServiceContract;
use EscolaLms\Core\Models\User as CoreUser;
use EscolaLms\Tags\Models\Tag;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
Expand Down Expand Up @@ -148,12 +150,12 @@ public function getTaxRate(): int
return $this->tax_rate ?? 0;
}

public function getBuyableByUserAttribute(?User $user = null): bool
public function getBuyableByUserAttribute(?CoreUser $user = null): bool
{
return app(ProductServiceContract::class)->productIsBuyableByUser($this, $user ?? Auth::user());
}

public function getOwnedByUserAttribute(?User $user = null): bool
public function getOwnedByUserAttribute(?CoreUser $user = null): bool
{
return app(ProductServiceContract::class)->productIsOwnedByUser($this, $user ?? Auth::user());
}
Expand Down