public function save() { $r = Input::all(); $r['date'] = sqldate($r['date']); $r['amount'] = unformat_money($r['amount']); $r['user_id'] = Auth::user()->id; $r['status'] = User::permitted('role.admin') === true ? 1 : 0; //Insert into database $created = Expenditure::create($r); $data['status'] = 'success'; $data['message'] = 'Record saved successfully!'; return Response::json($data); }