canDo('clientpay.client_order.view') && $user->isAdmin()) { return true; } return $client_order->user_id == user_id() && $client_order->user_type == user_type(); } /** * Determine if the given user can create a client_order. * * @param UserPolicy $user * @param ClientOrder $client_order * * @return bool */ public function create(UserPolicy $user) { return $user->canDo('clientpay.client_order.create'); } /** * Determine if the given user can update the given client_order. * * @param UserPolicy $user * @param ClientOrder $client_order * * @return bool */ public function update(UserPolicy $user, ClientOrder $client_order) { if ($user->canDo('clientpay.client_order.edit') && $user->isAdmin()) { return true; } return $client_order->user_id == user_id() && $client_order->user_type == user_type(); } /** * Determine if the given user can delete the given client_order. * * @param UserPolicy $user * @param ClientOrder $client_order * * @return bool */ public function destroy(UserPolicy $user, ClientOrder $client_order) { return $client_order->user_id == user_id() && $client_order->user_type == user_type(); } /** * Determine if the given user can verify the given client_order. * * @param UserPolicy $user * @param ClientOrder $client_order * * @return bool */ public function verify(UserPolicy $user, ClientOrder $client_order) { if ($user->canDo('clientpay.client_order.verify')) { return true; } return false; } /** * Determine if the given user can approve the given client_order. * * @param UserPolicy $user * @param ClientOrder $client_order * * @return bool */ public function approve(UserPolicy $user, ClientOrder $client_order) { if ($user->canDo('clientpay.client_order.approve')) { return true; } return false; } /** * Determine if the user can perform a given action ve. * * @param [type] $user [description] * @param [type] $ability [description] * * @return [type] [description] */ public function before($user, $ability) { if ($user->isSuperuser()) { return true; } } }