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