I need to show only records in which 'senderid' user has role('broker'). How can I use this condition in the controller ? I am using laratrust for roles management.
@MichalOravec Thanks for your time. I am getting the following error :
Call to undefined method Illuminate\Database\Eloquent\Builder::hasRole()
My model :
class BusinessLead extends Model
{
use HasFactory;
protected $guarded = [];
public function sender(){
return $this->belongsTo(User::class,'senderid','id');
}
}