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