canDo('leasing.lease.view') && $authUser->isAdmin() || $user->isClient()) { return true; } return $lease->is_owner; } /** * Determine if the given user can create a lease. * * @param Authenticatable $user * * @return bool */ public function create(Authenticatable $user) { return $authUser->canDo('leasing.lease.create'); } /** * Determine if the given user can update the given lease. * * @param Authenticatable $user * @param Lease $lease * * @return bool */ public function update(Authenticatable $user, Lease $lease) { if ($user->canDo('leasing.lease.edit') && $user->isAdmin()) { return true; } return $lease->is_owner; } /** * Determine if the given user can delete the given lease. * * @param Authenticatable $user * * @return bool */ public function destroy(Authenticatable $user, Lease $lease) { return $lease->is_owner; } /** * 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; } } }