Comments (7)
I'm working on this issue now. Once I created the sandbox it worked fine with the tests, so I'm trying to find out what's messing things up. It's not Laravel Spark.
I did find out that my test was flawed for ModelWasUnbanned
. To make that event trigger, the model needs to be banned first. (That's a good thing that duplicate unbans don't trigger it.)
I'll keep you updated to see what comes of the issue.
EDIT:
I FINALLY figured out the issue! I installed Laravel Ban for the Nova plugin, and to make the Ban
model Searchable
and Actionable
, and make populate $dates
with the expired_at
and deleted_at
items, I extended the model with my own in App\Models
. To make it be able to use $user->bans()
I also had to override the relationship method. In doing so, the subclass triggered, but the observer did not, even though it extended the parent that was being observed.
So, while I haven't looked, I think Laravel is probably mapping the class name to the events, and it doesn't see the event because the namespacing doesn't match.
\App\Models\User
gets banned, and creates a new\App\Models\Ban
(or deleted it if it's getting unbanned)\Cog\Laravel\Ban\Models\Ban
has the observer attached to it. However,Cog\Laravel\Ban\Models\Ban
does not match\App\Models\Ban
, and so Laravel doesn't know to fire the event.
All tests now pass. I added the Laravel Ban observer to my custom ban for nova, and gave it its own relationship method, thus leaving the original one in place.
Now I'm working on the issue from the OP, as they still don't trigger in Nova. Presumably it has something to do with the problem I just solved. I'll update this thread again once I've finished that.
Edit 2:
In second thought, I'll create a new issue in Nova Ban and link to this one so more people can find the issue if they have it since this side is done.
from laravel-ban.
from laravel-ban.
@rickmacgillis thank you for such a detailed research you've done! I need to return back to it later to overlook how all the stuff is implemented and if there is a way to avoid such situations in a future.
from laravel-ban.
Hi, @rickmacgillis! Thank you for the feedback. That's seems really strange for me. I will be able too look on it a bit later.
Could it be reproduced in tests or sandbox?
from laravel-ban.
Presumably this issue is related to my old issue #34, but now it doesn't trigger in the live environment. The tests from the old issue still don't work. (Neither the banned or unbanned events)
As for "sandbox", what are you referring to in this case?
from laravel-ban.
Thank you for the previous issue link!
As sandbox I meant github public repo with minimum required functionality to reproduce the bug.
from laravel-ban.
Welcome.
from laravel-ban.
Related Issues (20)
- Support for user UUIDs HOT 8
- How do I get information about a blocked user ? HOT 2
- Laravel 7 compatibility HOT 3
- how can I ban only once? HOT 2
- $user->isNotBanned not working in a blade file HOT 1
- Send notification on unban HOT 1
- Add support for more states HOT 3
- Laravel 8 unsupport and bug HOT 4
- PHP 8.0 support HOT 1
- Inertia compatibility HOT 4
- how to get expired_at in blade HOT 4
- Middlewares
- Dosen´t refresh the collection when I ban a user HOT 4
- Laravel 9 HOT 1
- allow us to configure the table on different connection / database please HOT 4
- Laravel API Middleware useage HOT 1
- Should add Qualified Banned At column name in scopes like SoftDeletes Trait
- Remove laravel/legacy-factory dev dependency
- bannable trait HOT 2
- something weird when banning models multiple times. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-ban.