protected function asSeller($seller = null) { if ($this->isShopTestCase()) { return $this->asShopOwner($seller ?: ($this->order ? $this->order->getSeller() : null)); } return $this->asUser($seller ?: ($this->order ? $this->order->getSeller() : null)); }
public function review(User $user, Shop $shop, Order $order) { return $user->is($order->getUser()) and $shop->is($order->getSeller()) and $shop->canBeReviewed($order); }
public function isOrderSeller(Order $order) { // either user is seller or, if user has shop, shop is seller return $this->is($order->getSeller()) or $this->hasShop() and $this->getShop()->is($order->getSeller()); }
public function getOrderRole(Order $order = null, $self = true) { if (!$order) { return $self ? '卖家' : '买家'; } if ($this->is($order->getUser())) { return $self ? '买家' : '卖家'; } if ($this->is($order->getSeller())) { return $self ? '卖家' : '买家'; } return null; }