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
No comments:
Post a Comment