Пример #1
0
 /**
  * @param $id
  * @return bool
  * @throws GeneralException
  */
 public function restore($id)
 {
     $user = $this->findOrThrowException($id);
     if ($user->restore()) {
         $productos = \DB::table('productos')->where('user_id', $user->id)->whereNotNull('deleted_at')->get();
         //dd($productos);
         foreach ($productos as $key) {
             $producto = \App\productos::findOrFail($key->id);
             $producto->deleted_at = null;
             //dd($producto);
             $producto->save();
         }
         return true;
     }
     throw new GeneralException("Se encontro un problema restaurando este provedor. Intente nuevamente.");
 }