Example #1
0
 /**
  * Store a newly created destino in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Destino::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     Destino::create($data);
     return Redirect::route('destinos.index');
 }
Example #2
0
 /**
  * Store a newly created department in storage.
  */
 public function store()
 {
     $validator = Validator::make($input = Input::all(), Destino::rules());
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $dest = Destino::create(['destino' => $input['destino']]);
     foreach ($input['objetivo'] as $index => $value) {
         if ($value == '') {
             continue;
         }
         Objetivo::firstOrCreate(['destID' => $dest->id, 'objetivo' => $value]);
     }
     return Redirect::route('admin.destinos.index')->with('success', "<strong>{$input['destino']}</strong> Adicionado correctamente....");
 }