cybercog / laravel-ban

Laravel Ban simplify blocking and banning Eloquent models.
https://komarev.com/sources/laravel-ban
MIT License
1.06k stars 63 forks source link

Dosen´t refresh the collection when I ban a user #80

Open olkotz opened 2 years ago

olkotz commented 2 years ago

Hi everyone! Excelent work with the package!!!

I have found in one of my tests that the variable that contained the user model instance was not updated after applying the ban() function to it.

Example: $user = User::find($id); $user->ban(); if i look into the $user dosen´t have updated the field banned_at.

I think this should not be the case and should be updated. Hope this helps!

Thanks!!!

antonkomarev commented 2 years ago

How can we reproduce this issue? How are you checking that model was not updated?

gogl92 commented 2 years ago

I was able to reproduce this issue, with PHP 8.0 and Laravel 9, I'm not sure if this is a cache configuration, I did it through tinker @antonkomarev

antonkomarev commented 2 years ago

It will be great to reproduce bug in integration tests, it will help a lot

gogl92 commented 2 years ago

@antonkomarev Sure, I'll try to add a test