After doing a little more digging, I found that the two facades are returning different information because a little piece of information that I accidentally left out was that I'm also using Spark.
It seems that Spark is injecting some functions to the User facade that I didn't realize.
Does anyone know if it is possible to put a Where clause on the User facade? So that I can return just the users that I need? This would help tremendously.
So, anyone trying to figure out this on their own, I have finally found the right solution and it was much simpler than I anticipated.
In your User model, just add this code:
public function scopeState($query, $state)
{
return $query->where('emailNotification', 'like', '%'.$state.'%');
}
This essentially creates your own search query on the User facade. Now instead of calling User::all();, you just call User::state($state)->get(); and this returns exactly what I was looking for.
Hopefully, this will help someone else looking to do something similar.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community