Beispiel #1
0
 public function delete($cod = null)
 {
     if (is_null($cod)) {
         Redirect::to('404.html');
     } else {
         $agencia = Agencia::where('codAgencia', '=', $cod)->firstOrFail();
         if (is_object($agencia)) {
             $agencia->estado = '0';
             $agencia->save();
             return Redirect::to('agencias');
         }
     }
 }
Beispiel #2
0
 public function uploadImage($id = null)
 {
     $mensaje = "Ocurrio Error";
     if (Input::file("foto")->isValid()) {
         $file = Input::file("foto");
         $fileName = Input::file('foto')->getClientOriginalName();
         $agencia = Agencia::where('id', '=', $id)->firstOrFail();
         $agencia->foto = md5($id . "-" . $fileName) . '.' . Input::file('foto')->getClientOriginalExtension();
         if ($agencia->save()) {
             Input::file('foto')->move('assets/foto', $agencia->foto);
             $mensaje = "Imagen actualizado";
         }
     }
     return Redirect::to('agencia/profile/' . $id)->withErrors($mensaje);
 }