I have a stock setup of Nova with User and Client models. Web guard has been bound to Client as per documentation.
Now I want Nova resources for users and clients.
Users have the "User" role, and Clients have the "Client" role.
I want to only see Clients when I load the Nova resource, so I my first instinct is a scope to display Clients but filter on hasRole('Client');
The scope syntax throws me off though, and doesn't work.
<php
class ClientScope implements Scope
{
public function apply(Builder $builder, Model $model)
{
$builder->where($model->hasRole('Client'));
}
}
The error returned:
SQLSTATE[42S22]: Column not found: 1054 Unknown column '' in 'where clause' (SQL: select * from `users` where `` is null order by `users`.`id` desc limit 26 offset 0) {"userId":1,"exception":"[object] (Illuminate\Database\QueryException(code: 42S22): SQLSTATE[42S22]: Column not found:
Any ideas how I can get a list of models filtered by role for beautiful Nova displaying?
I'm sure this should be trivial but my Eloquent is letting me down.