예제 #1
0
 /**
  * Returns a JSON tree of all avaliable nodes in a given location.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Contracts\View\View
  */
 public function postNewServerGetNodes(Request $request)
 {
     if (!$request->input('location')) {
         return response()->json(['error' => 'Missing location in request.'], 500);
     }
     return response()->json(Models\Node::select('id', 'name', 'public')->where('location', $request->input('location'))->get());
 }
예제 #2
0
 public function getNew(Request $request)
 {
     return view('admin.databases.new', ['nodes' => Models\Node::select('nodes.id', 'nodes.name', 'locations.long as a_location')->join('locations', 'locations.id', '=', 'nodes.location')->get()]);
 }
예제 #3
0
 public function getIndex(Request $request)
 {
     return view('admin.nodes.index', ['nodes' => Models\Node::select('nodes.*', 'locations.long as a_locationName', DB::raw('(SELECT COUNT(*) FROM servers WHERE servers.node = nodes.id) as a_serverCount'))->join('locations', 'nodes.location', '=', 'locations.id')->paginate(20)]);
 }