outl1ne / nova-page-manager

Static page and region manager for Laravel Nova - designed for headless CMS's.
MIT License
180 stars 39 forks source link

Using Spatie's Laravel Translatable #9

Closed slovenianGooner closed 5 years ago

slovenianGooner commented 5 years ago

Hi, have you had any thoughts on implementing Spatie's package to manage the translations? It would make for less entries in the database.

Tarpsvo commented 5 years ago

Hey, haven't really thought about it. I know that Spatie's nova-translatable field will not work, as they manipulate the child fields' attributes in a weird way (page manager prefixes attributes with data-> and nova-translatable adds another pfefix translatable_ to that, so the whole thing blows up).

But using the Laravel Translatable library directly could work, except I'm not sure if it's better in any way, besides using up less rows. Rows aren't exactly limited in any way either and I think it's a lot easier to query the models if they're separate rows.

What improvements would you like to see when using Laravel Translatable?

slovenianGooner commented 5 years ago

Well, querying the rows isn't really the issue - I use the package in combination with https://github.com/DigitalCloud/multilingual-nova which makes it easy to switch between languages.

I had troubles finding a way to delete a specific translation in your package, so maybe you could add a button to do that on each translation in the DetailField.

I also created a pull request to move the list of locales from the IndexField to DetailField. For example, I have 8 locales, and even after 3 or 4 locales, the list of locales on index is messed up.

https://github.com/optimistdigital/nova-page-manager/pull/8

Perhaps that would be a good start. I can try to implement the "delete" button next to the list of locales in the near future, if you'd like.

Tarpsvo commented 5 years ago

Ah, the delete button. To see all the so-called "child" pages, you have to open the Filters and select 'Show child locales', then you can delete them directly from the Index view. I'm gonna look at the PR in a second. :) Thanks.