Skip to content
Advertisement

Return all table’s rows in a Select field laravel Nova

I would like to return to my select all the elements of my ‘categories’ table except the current line. I didn’t find anything about this on the internet, so I’m coming to you.

My current item for Select:

JavaScript

And this is the head of my categories table:

Categories table

Advertisement

Answer

I understand you have a self referrencing relationship between the Category model, and itself such as

JavaScript

In Nova usually, you would express the relationship between the Child and its Parent not as a Select field, but as a BelongsTo such as:

JavaScript

But you could use the Select field to have a pre-loaded array of Categories so you can filter out the current category onlyOnForms().

You can do it this way:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement