Closed MaartenJC closed 5 months ago
I don't think this package is compatible with spatie translatable
It actually works great except for this problem. So would it be an option to modify te code from: $pageUrls = FilamentFabricator::getPageUrls(); to: $pageUrls = FilamentFabricator::getPageUrls($locale);
Ok I will look in to this for future updates
Has this been implemented already? Any news on this?
Hi there! I have been able to use Spatie Translatable with Fabricator.
I've done this by simply overriding FilamentFabricatorManager#setPageUrl
as well as the routing and the route parameter binding. Just to ensure everything works smoothly, I also added a locale detector middleware.
I've made a gist for that: https://gist.github.com/Voltra/191666f4af51e42528e54bfc682661e9
@Voltra I'd be open to a PR on this as a opt-in feature. (eg: needs to be enabled in the config to use it)
As described in this comment https://github.com/Z3d0X/filament-fabricator/pull/119#issuecomment-1890588386 localization is better off as a project side configuration
I use Fabricator with Spatie Translatable. So slugs are stored like: {"nl":"test-nl","de":"test-de"}
When the Dutch locale is set, the pageUrls are like this: $pageUrls[1] = "/test-nl"
This is Cached with the key: filament-fabricator::page-urls
When the German page is requested, the Dutch $pageUrls are returned so no page is found.