OwnedOrFail
blendsoft opened this issue · 3 comments
blendsoft commented
Could you add method(s) throwing exception when not owner ?
antonkomarev commented
@blendsoft Throw exception when model don't have any owners or when exact user not an owner of it?
Could you provide usage example, please?
antonkomarev commented
You can use default firstOrFail
method mixed with whereOwnedBy
scope:
Article::whereKey($articleId)->whereOwnedBy($user)->firstOrFail();
Does this help?
antonkomarev commented
Closing this issue. Feel free to continue conversation if solution proposed above didn't help.