/**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @param Request $request
  * @return Response
  */
 public function destroy($id, Request $request)
 {
     $cabinet = Cabinet::findOrFail($request->get('cabinet_id'));
     $cabinet->wires()->detach($id);
     $message = trans('messages.wire_successfully_disassociated');
     Flash::warning($message);
     return redirect()->back();
 }
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function show($id)
 {
     $cabinet = Cabinet::findOrFail($id);
     $config = array();
     $config['center'] = "{$cabinet->latitude}, {$cabinet->longitude}";
     Gmaps::initialize($config);
     $content = '<div id="content"> <div id="siteNotice"> </div>' . '<h1 id="firstHeading" class="firstHeading">' . $cabinet->reference . '</h1>' . '<div id="bodyContent"><p>' . $cabinet->description . '</p>' . '<p><a class="btn btn-primary" target="_blank" href="https://www.google.co.ve/maps/dir/CANTV,+Calle+Boyaca,+San+Fernando+de+Apure/' . $cabinet->latitude . ',' . $cabinet->longitude . '/@7.8900719, -67.4727032,18z">' . trans('buttons.how_to_get') . ' </a></p></div></div>';
     $marker = array();
     $marker['position'] = "{$cabinet->latitude}, {$cabinet->longitude}";
     $marker['infowindow_content'] = $content;
     $marker['animation'] = 'DROP';
     Gmaps::add_marker($marker);
     $map = Gmaps::create_map();
     return view('cabinets.show')->with('cabinet', $cabinet)->with('map', $map)->with('title', trans('titles.details_of_cabinet'));
 }
 /**
  * @return View
  */
 public function index()
 {
     $config = array();
     $config['center'] = config('gmap.center');
     Gmaps::initialize($config);
     $cabinets = Cabinet::all();
     foreach ($cabinets as $cabinet) {
         $content = '<div id="content"> <div id="siteNotice"> </div>' . '<h1 id="firstHeading" class="firstHeading">' . $cabinet->reference . '</h1>' . '<div id="bodyContent"><p>' . $cabinet->description . '</p>' . '<p><a class="btn btn-primary" target="_blank" href="https://www.google.co.ve/maps/dir/CANTV,+Calle+Boyaca,+San+Fernando+de+Apure/' . $cabinet->latitude . ',' . $cabinet->longitude . '/@7.8900719, -67.4727032,18z">' . trans('buttons.how_to_get') . ' </a> ' . '<a href="' . route('admin.cabinets.edit', $cabinet) . '" class="btn btn-default">' . trans('buttons.details') . '</a>' . '</p></div></div>';
         $marker = array();
         $marker['position'] = "{$cabinet->latitude}, {$cabinet->longitude}";
         $marker['infowindow_content'] = $content;
         $marker['animation'] = 'DROP';
         Gmaps::add_marker($marker);
     }
     $map = Gmaps::create_map();
     return view('admin.index')->with('map', $map)->with('title', trans('titles.dashboard'));
 }
 /**
  * Show the application dashboard to the user.
  *
  * @param Request $request
  * @return Response
  */
 public function index(Request $request)
 {
     $criteria = $request->get('criteria');
     $query = $request->get('query');
     switch ($criteria) {
         case 'reference':
             $cabinets = Cabinet::reference($query)->paginate();
             break;
         case 'street':
             $cabinets = Cabinet::street($query)->paginate();
             break;
         case 'croos':
             $cabinets = Cabinet::croos($query)->paginate();
             break;
         case '':
             $cabinets = Cabinet::reference($query)->paginate();
             break;
     }
     return view('index')->with('cabinets', $cabinets)->with('title', trans('titles.home'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return \Illuminate\Http\RedirectResponse
  * @internal param Request $request
  */
 public function destroy($id)
 {
     $cabinet = Cabinet::findOrFail($id);
     $cabinet->delete();
     $message = trans('messages.cabinet_successfully_removed');
     Flash::warning($message);
     return redirect()->route('admin.cabinets.index');
 }