Adding a XOR constraint via Laravel migration - development

Adding a XOR constraint via Laravel migration

I am trying to build a table of this structure using Laravel’s migrations feature:

------------------------------------
| Data  | Rules | Allow | Restrict |
------------------------------------
| item1 | rule1 | 1,3   |   null   |
| item2 | rule2 | null  |  2,5,6   |
------------------------------------

As in, for each entry either Allow or Restrict must possess a not null value, but not both. I’ve found this comment which sounds like the condition I need, but I need to express it in a format understandable to Laravel.



from Laravel Questions and Answers https://laravelquestions.com/php/adding-a-xor-constraint-via-laravel-migration/
via Lzo Media

Comments

Popular posts from this blog

ng-show doesn’t work correct with value boolean

Using PHP and MySQL data to generate PDF letters like in MS Word mailmerge functionality - development

ng-include of inline SVG does not display gradient except in Chrome