Modified how entrust adds permissions #929
Modified how entrust adds permissions #929blakethepatton wants to merge 1 commit intoZizaco:masterfrom blakethepatton:fix/respect-fk-constraints-on-add
Conversation
The sync method takes in an array, and any item with its id missing from that array will be removed https://laravel.com/docs/5.7/eloquent-relationships#Syncing-Associations. Based on the docs you cannot do this |
Based on the actual complete documentation, the laravel api docs, you can do this without removing records. The sync method acutally takes in a collection OR an array, as well as an optional boolean. Perhaps you didn't notice that I set the second parameter to The documentation: The actual source file: |
This way, duplicate records aren't added and foreign key constraints don't become an issue.