예제 #1
0
 public function getEdit($id = null)
 {
     $address = \App\Address::where('user_id', '=', \Auth::id())->get()->first();
     if (is_null($address)) {
         \Session::flash('flash_message', 'Address not found');
         return redirect('addresses/create');
     }
     $stateModel = new \App\State();
     $states_for_dropdown = $stateModel->getStatesForDropdown();
     return view('address.edit')->with('address', $address)->with(['states_for_dropdown' => $states_for_dropdown]);
 }
예제 #2
0
 public function getEdit($id = null)
 {
     $accounts = \App\Account::where('user_id', '=', \Auth::id())->find($id);
     if (is_null($accounts)) {
         \Session::flash('flash_message', 'Account not found');
         return redirect('account/create');
     }
     $stateModel = new \App\State();
     $states_for_dropdown = $stateModel->getStatesForDropdown();
     $acctTypes = ['Checking', 'Savings', 'Credit Card'];
     return view('account.edit')->with('accounts', $accounts)->with(['states_for_dropdown' => $states_for_dropdown])->with(['acctTypes' => $acctTypes]);
 }
예제 #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = \Validator::make(\Input::all(), \App\State::$rules);
     if ($validator->passes()) {
         $state = new \App\State();
         $state->name = \Input::get('name');
         $state->country_id = \Input::get('country');
         $state->save();
         flash('State added.');
         return \Redirect::back();
     }
     return \Redirect::back()->withInput()->withErrors($validator);
 }