Tree model query works fine:
$tree->query(function ($model) use($productid) {
return $model->where('user_id', Auth::guard('admin')->user()->id);
});
How to apply same query under:
$form->select('parent_id','Parent')->options(Document::selectOptions());
Try Document::where('user_id', Admin::user()->id)->selectOptions()
No it's not working, I have created my own function under the model to resolve this issue:
public static function selectedOptions()
{
$options = Document::where('user_id', Auth::guard('admin')->user()->id)->orderby('order')->get()->toArray();
if (!empty($options))
$options = (new static())->buildSelectOptions($options);
return collect($options)->prepend('Root',0)->all();
}
Most helpful comment
No it's not working, I have created my own function under the model to resolve this issue: