Open vanvanni opened 4 years ago
Hi, i just came across the same problem, i got it down to:
$search = [
'term' => $request->input('term', '')
];
if( $search['term'] ) {
$list = MyModel::search($search['term'])->query(function($builder) {
/** @var \Illuminate\Database\Eloquent\Builder $builder */
$builder
->with('latestAudit');
});
}
else {
$list = MyModel::with('latestAudit');
}
$list = $list->paginate(20);
Not pretty, but it works for me.
Ah... i just saw it wont work, see #102
I want to load in my relation when using search but I cannot use the
with()
method. I have been searching around for solutions and people starting to useload()
but that is also not available.What options do I have left here?