policy icon indicating copy to clipboard operation
policy copied to clipboard

Update method returns null object

Open ReubenFrimpong opened this issue 6 years ago • 2 comments

Hi, According to the docs the update method is supposed to be used like this $Gate.allow('update',post). However this returns false always. Furthermore, the blog post linked also implements it differently $gate.allow('update','post', post) which also returns a null object. Could it be that something is not being done properly?

ReubenFrimpong avatar Aug 28 '20 08:08 ReubenFrimpong

Hey,

The blog post and the package have a different code at the moment, so you should not compare them directly. But for the update fix, feel free to open a PR.

iamgergo avatar Aug 28 '20 10:08 iamgergo

My bad. I forgot to add the use UsesModelName; and protected $appends = ['model_name']; to my Eloquent model. Everything works fine. Thanks for such a wonderful package. I'm considering a blog post for it.

ReubenFrimpong avatar Aug 31 '20 14:08 ReubenFrimpong