/** * Display a listing of the resource. * * @param Request $request * * @return Response */ public function index(Request $request) { // varianta simpla $users = User::all()->map(function ($item, $key) { $item->links = ['addresses' => 'addresses']; return $item; }); return response()->json(['users' => $users]); // varianta cu datatables return Datatables::of(User::select('*'))->addColumn('links', function ($user) { return ['addresses' => 'addresses']; })->make(true); }