categories()->orderBy('name','ASC')->get(); $return = []; foreach ($list as $entry) { $return[] = $entry->name; } return Response::json($return); } /** * Returns a JSON list of all beneficiaries. * * @return \Illuminate\Http\JsonResponse */ public function expenseAccounts() { $list = Auth::user()->accounts()->accountTypeIn(['Expense account', 'Beneficiary account'])->get(); $return = []; foreach ($list as $entry) { $return[] = $entry->name; } return Response::json($return); } /** * @return \Illuminate\Http\JsonResponse */ public function revenueAccounts() { $list = Auth::user()->accounts()->accountTypeIn(['Revenue account'])->get(); $return = []; foreach ($list as $entry) { $return[] = $entry->name; } return Response::json($return); } }