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