Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Slug Rules Not Being Applied #11220

Open
xyNNN opened this issue Dec 5, 2024 · 8 comments
Open

Custom Slug Rules Not Being Applied #11220

xyNNN opened this issue Dec 5, 2024 · 8 comments

Comments

@xyNNN
Copy link

xyNNN commented Dec 5, 2024

Bug description

I want to modify the slug validation for a collection. Specifically, I’d like to allow slashes (/) in the slug field. However, when I try to save an entry, I receive the error message: 'This URI has already been assigned.

How to reproduce

  1. Overwrite the EntryRepository with a custom implementation.
  2. Override the repository methods: createRules, updateRules, and bindings.
  3. Modify the slug method to prevent slugifying the provided value for the collection slug.

image
image
image

Logs

No response

Environment

Environment
Application Name: Laravel
Laravel Version: 11.25.0
PHP Version: 8.2.25
Composer Version: 2.8.2
Environment: local
Debug Mode: ENABLED
URL: domain.development
Maintenance Mode: OFF
Timezone: UTC
Locale: de

Cache
Config: CACHED
Events: CACHED
Routes: CACHED
Views: CACHED

Drivers
Broadcasting: null
Cache: redis
Database: pgsql
Logs: stack / single
Mail: smtp
Queue: sync
Session: redis

Pulse
Enabled: OFF
Version: v1.2.5

Livewire
Livewire: v3.5.8

Sentry
Enabled: MISSING DSN
Environment: local
Laravel SDK Version: 4.9.0
PHP SDK Version: 4.9.0
Release: 60e416e9
Sample Rate Errors: 100%
Sample Rate Performance Monitoring: NOT SET
Sample Rate Profiling: NOT SET
Send Default PII: DISABLED

Statamic
Addons: 2
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.40.0 PRO

Statamic Addons
statamic/eloquent-driver: 4.18.0
statamic/seo-pro: 6.3.0

Statamic Eloquent Driver
Asset Containers: file
Assets: file
Blueprints: file
Collection Trees: file
Collections: file
Entries: file
Forms: file
Global Sets: file
Global Variables: file
Navigation Trees: file
Navigations: file
Revisions: file
Sites: file
Taxonomies: file
Terms: file
Tokens: file

Installation

Existing Laravel app

Additional details

No response

@jasonvarga
Copy link
Member

The slug field also displays validation for URIs. If the URI of that entry is taken, it'll display there.

What you're seeing is validation for the URI, not the slug.

Is what you're entering causing the URI to be the same as another entry?

@xyNNN
Copy link
Author

xyNNN commented Dec 5, 2024

The slug field also displays validation for URIs. If the URI of that entry is taken, it'll display there.

What you're seeing is validation for the URI, not the slug.

Is what you're entering causing the URI to be the same as another entry?

Thanks for your prompt reply. No, even if I put some random stuff like "tesekwew/qweqew" it say's that the URI is taken.

@jasonvarga
Copy link
Member

Whats the route for that collection?

@xyNNN
Copy link
Author

xyNNN commented Dec 5, 2024

Whats the route for that collection?

route: '/ratgeber/{slug}'

@jasonvarga
Copy link
Member

Are you still saving the entries as files?

@xyNNN
Copy link
Author

xyNNN commented Dec 5, 2024

Are you still saving the entries as files?

Yes. This is the Problem because the filename is the UR, or? Only possible when I am using eloquent as driver?

@xyNNN
Copy link
Author

xyNNN commented Dec 10, 2024

@jasonvarga I would rather not stress or bother you, but could please you give me an update on this? Is the use of slugs with storage in files instead of a database not possible? Thanks mate!

@jasonvarga
Copy link
Member

Sorry it should be fine but I was just wondering if maybe a duplicate file somehow had something to do with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants