I need to paginate this where I need to find id but i don't know how.
function customerContact($id)
{
$customers = Customer::with('contacts')->find($id);
return Inertia::render('Customers/Contacts/Index', [
'customers' => $customers,
]);
}
CodePudding user response:
Try this
$customers = Customer::find($id)->contacts()->paginate();
CodePudding user response:
on the third line in the customerContact() function
$customers = Customer::with('contacts')->find($id);
change to
$customers = Customer::find($id)->contacts()->paginate();