canDo('coin.coin.view') && $user->isAdmin()) { return true; } return $coin->user_id == user_id() && $coin->user_type == user_type(); } /** * Determine if the given user can create a coin. * * @param UserPolicy $user * @param Coin $coin * * @return bool */ public function create(UserPolicy $user) { return $user->canDo('coin.coin.create'); } /** * Determine if the given user can update the given coin. * * @param UserPolicy $user * @param Coin $coin * * @return bool */ public function update(UserPolicy $user, Coin $coin) { if ($user->canDo('coin.coin.edit') && $user->isAdmin()) { return true; } return $coin->user_id == user_id() && $coin->user_type == user_type(); } /** * Determine if the given user can delete the given coin. * * @param UserPolicy $user * @param Coin $coin * * @return bool */ public function destroy(UserPolicy $user, Coin $coin) { return $coin->user_id == user_id() && $coin->user_type == user_type(); } /** * Determine if the given user can verify the given coin. * * @param UserPolicy $user * @param Coin $coin * * @return bool */ public function verify(UserPolicy $user, Coin $coin) { if ($user->canDo('coin.coin.verify')) { return true; } return false; } /** * Determine if the given user can approve the given coin. * * @param UserPolicy $user * @param Coin $coin * * @return bool */ public function approve(UserPolicy $user, Coin $coin) { if ($user->canDo('coin.coin.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; } } }