canDo('asset.approved_jobs.view') && $authUser->isAdmin()) { return true; } return $approved_jobs->user_id == user_id() && $approved_jobs->user_type == user_type(); } /** * Determine if the given user can create a approved_jobs. * * @param UserPolicyInterface $authUser * * @return bool */ public function create(UserPolicyInterface $authUser) { return $authUser->canDo('asset.approved_jobs.create'); } /** * Determine if the given user can update the given approved_jobs. * * @param UserPolicyInterface $authUser * @param ApprovedJobs $approved_jobs * * @return bool */ public function update(UserPolicyInterface $authUser, ApprovedJobs $approved_jobs) { if ($authUser->canDo('asset.approved_jobs.edit') && $authUser->isAdmin()) { return true; } return $approved_jobs->user_id == user_id() && $approved_jobs->user_type == user_type(); } /** * Determine if the given user can delete the given approved_jobs. * * @param UserPolicyInterface $authUser * * @return bool */ public function destroy(UserPolicyInterface $authUser, ApprovedJobs $approved_jobs) { return $approved_jobs->user_id == user_id() && $approved_jobs->user_type == user_type(); } /** * Determine if the given user can verify the given approved_jobs. * * @param UserPolicyInterface $authUser * * @return bool */ public function verify(UserPolicyInterface $authUser, ApprovedJobs $approved_jobs) { if ($authUser->canDo('asset.approved_jobs.verify')) { return true; } return false; } /** * Determine if the given user can approve the given approved_jobs. * * @param UserPolicyInterface $authUser * * @return bool */ public function approve(UserPolicyInterface $authUser, ApprovedJobs $approved_jobs) { if ($authUser->canDo('asset.approved_jobs.approve')) { return true; } return false; } /** * Determine if the user can perform a given action ve. * * @param [type] $authUser [description] * @param [type] $ability [description] * * @return [type] [description] */ public function before($authUser, $ability) { if ($authUser->isSuperuser()) { return true; } } }