returning two yajra datatable using single method on the sam view laravel

47

public function index(ProductsDataTable $productDatatable, UsersDataTable $userDatatable)
{    
if (request()->has('product') {
    return $productDatatable->render('view');
}

if (request()->has('user') {
    return $productDatatable->render('view');
}

$user = Auth::user();

$products = $user->products;

return view('admin.dashboard', compact('products', 'user', 'productDatatable', 'userDatatable'));
}

Comments

Submit
0 Comments