Return all products under a category in Laravel web api

The solution for “Return all products under a category in Laravel web api” can be found here. The following code will assist you in solving the problem.

public function show($id) {
$userWithDoc = User::where(‘users.document_type_id’, ‘=’, $id)
->join(‘document_types’, ‘document_types.id’, ‘=’, ‘users.document_type_id’)
->get();

return response()->json($userWithDoc);
}

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in