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