jeudi 22 juillet 2021

Laravel set column table as unique

I need to add a column on a table database to mark a product as default. The column value has to be true or null (or maybe false if it's easier that way). It must be just one product marked as default so in case one user selects one product as default the previous default product must be marked as null.

I've been trying with unique value and nullable attributes but it's not doing what I want.

I should do it with an Event? there's no simplier way?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3iEzMRW
via IFTTT

Aucun commentaire:

Enregistrer un commentaire