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

تعليقات

المشاركات الشائعة من هذه المدونة

BlueHost Web Hosting Review: Secrets Revealed for Shared Hosting

How to Create Treeview with Bootstrap and jQuery

Submit Form using jQuery AJAX and PHP without Page Refresh