Exemplo n.º 1
0
 public static function postEditService()
 {
     if (Auth::check()) {
         $validation = \App\Models\Service::validate(Input::all());
         if ($validation->passes()) {
             $raw = 'UPDATE sluzby SET Cena = ' . Input::get('price') . ', Nazov = "' . Input::get('name') . '" WHERE CisSluzby = ' . Input::get('id');
             DB::select(DB::raw($raw));
             return Redirect::route('home')->with('message', 'Editing of service was successfull!');
         } else {
             foreach (\App\Models\Service::showService(Input::get('id')) as $value) {
                 $my_service = $value;
             }
             return Redirect::route('editservice')->withErrors($validation)->withInput()->with('service', $my_service);
         }
     } else {
         return Redirect::route('home')->with('message', 'You are not logged in!');
     }
 }