This commit is contained in:
Edward Yang 2022-08-25 16:51:18 +08:00
parent fbb35e59be
commit 106471ea2e
2 changed files with 4 additions and 2 deletions

View File

@ -56,7 +56,9 @@ class Product extends Base
public function inCurrentWishlist()
{
return $this->hasOne(CustomerWishlist::class)->where('customer_id', current_customer() ? current_customer()->id : 0);
$customer = current_customer();
$customerId = $customer ? $customer->id : 0;
return $this->hasOne(CustomerWishlist::class)->where('customer_id', $customerId);
}
public function getUrlAttribute()

View File

@ -39,6 +39,7 @@ class ShopServiceProvider extends ServiceProvider
$this->loadRoutesFrom(__DIR__ . '/../Routes/shop.php');
load_settings();
$this->registerGuard();
if (Str::startsWith($uri, '/admin')) {
return;
@ -50,7 +51,6 @@ class ShopServiceProvider extends ServiceProvider
]);
$this->mergeConfigFrom(__DIR__ . '/../../Config/beike.php', 'beike');
$this->registerGuard();
$this->loadThemeViewPath();
$this->loadComponents();
}