@@ -37,7 +37,7 @@ |
||
| 37 | 37 | */ |
| 38 | 38 | public function map(Router $router) |
| 39 | 39 | { |
| 40 | - $router->group(['namespace' => $this->namespace], function ($router) { |
|
| 40 | + $router->group(['namespace' => $this->namespace], function($router) { |
|
| 41 | 41 | require app_path('Http/routes.php'); |
| 42 | 42 | }); |
| 43 | 43 | } |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | * Store a newly created resource in storage. |
| 47 | 47 | * |
| 48 | 48 | * @param \Illuminate\Http\Request $request |
| 49 | - * @return \Illuminate\Http\Response |
|
| 49 | + * @return \Illuminate\Http\RedirectResponse |
|
| 50 | 50 | */ |
| 51 | 51 | public function store(Request $request) |
| 52 | 52 | { |
@@ -3,11 +3,8 @@ |
||
| 3 | 3 | namespace App\Http\Controllers; |
| 4 | 4 | |
| 5 | 5 | use Dingo\Api\Http; |
| 6 | -use Dingo\Api\Routing\Router; |
|
| 7 | 6 | use Dingo\Api\Routing\Helpers; |
| 8 | -use App\Http\Requests; |
|
| 9 | 7 | use Illuminate\Http\Request; |
| 10 | -use JWTAuth; |
|
| 11 | 8 | |
| 12 | 9 | class HomeController extends Controller |
| 13 | 10 | { |
@@ -3,11 +3,8 @@ |
||
| 3 | 3 | namespace App\Http\Controllers; |
| 4 | 4 | |
| 5 | 5 | use Dingo\Api\Http; |
| 6 | -use Dingo\Api\Routing\Router; |
|
| 7 | 6 | use Dingo\Api\Routing\Helpers; |
| 8 | -use App\Http\Requests; |
|
| 9 | 7 | use Illuminate\Http\Request; |
| 10 | -use JWTAuth; |
|
| 11 | 8 | |
| 12 | 9 | class HomeController extends Controller |
| 13 | 10 | { |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use App\User; |
| 6 | 6 | use App\Device; |
| 7 | -use App\Port; |
|
| 8 | 7 | use Illuminate\Http\Request; |
| 9 | 8 | |
| 10 | 9 | class DeviceController extends Controller |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | if ($request->query('displayFormat') == 'human') { |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - return $devices; |
|
| 34 | + return $devices; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -19,8 +19,7 @@ discard block |
||
| 19 | 19 | public function list_devices(Request $request) { |
| 20 | 20 | if ($request->user()->level >= 10 || $request->user()->level == 5) { |
| 21 | 21 | return Device::all(); |
| 22 | - } |
|
| 23 | - else { |
|
| 22 | + } else { |
|
| 24 | 23 | return User::find($request->user()->user_id)->devices()->get(); |
| 25 | 24 | } |
| 26 | 25 | } |
@@ -31,8 +30,7 @@ discard block |
||
| 31 | 30 | public function list_ports(Request $request) { |
| 32 | 31 | if ($request->user()->level >= 10 || $request->user()->level == 5) { |
| 33 | 32 | return Port::all(); |
| 34 | - } |
|
| 35 | - else { |
|
| 33 | + } else { |
|
| 36 | 34 | return User::find($request->user()->user_id)->ports()->get(); |
| 37 | 35 | } |
| 38 | 36 | } |
@@ -19,8 +19,7 @@ discard block |
||
| 19 | 19 | public function list_devices(Request $request) { |
| 20 | 20 | if ($request->user()->level >= 10 || $request->user()->level == 5) { |
| 21 | 21 | return Device::all(); |
| 22 | - } |
|
| 23 | - else { |
|
| 22 | + } else { |
|
| 24 | 23 | return User::find($request->user()->user_id)->devices()->get(); |
| 25 | 24 | } |
| 26 | 25 | } |
@@ -31,8 +30,7 @@ discard block |
||
| 31 | 30 | public function list_ports(Request $request) { |
| 32 | 31 | if ($request->user()->level >= 10 || $request->user()->level == 5) { |
| 33 | 32 | return Port::all(); |
| 34 | - } |
|
| 35 | - else { |
|
| 33 | + } else { |
|
| 36 | 34 | return User::find($request->user()->user_id)->ports()->get(); |
| 37 | 35 | } |
| 38 | 36 | } |
@@ -45,13 +45,13 @@ |
||
| 45 | 45 | // TODO: move to a common file |
| 46 | 46 | // base = 1024 for bits, 1000 for mibibits |
| 47 | 47 | function formatBps($bits, $precision = 2, $base=1000) { |
| 48 | - $units = array('bps', 'Kbps', 'Mbps', 'Gbps', 'Tbps'); |
|
| 48 | + $units = array('bps', 'Kbps', 'Mbps', 'Gbps', 'Tbps'); |
|
| 49 | 49 | |
| 50 | - $bits = max($bits, 0); |
|
| 51 | - $pow = floor(($bits ? log($bits) : 0) / log($base)); |
|
| 52 | - $pow = min($pow, count($units) - 1); |
|
| 50 | + $bits = max($bits, 0); |
|
| 51 | + $pow = floor(($bits ? log($bits) : 0) / log($base)); |
|
| 52 | + $pow = min($pow, count($units) - 1); |
|
| 53 | 53 | |
| 54 | - $bits /= pow($base, $pow); |
|
| 54 | + $bits /= pow($base, $pow); |
|
| 55 | 55 | |
| 56 | 56 | return round($bits, $precision) . ' ' . $units[$pow]; |
| 57 | 57 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | // TODO: move to a common file |
| 46 | 46 | // base = 1024 for bits, 1000 for mibibits |
| 47 | - function formatBps($bits, $precision = 2, $base=1000) { |
|
| 47 | + function formatBps($bits, $precision = 2, $base = 1000) { |
|
| 48 | 48 | $units = array('bps', 'Kbps', 'Mbps', 'Gbps', 'Tbps'); |
| 49 | 49 | |
| 50 | 50 | $bits = max($bits, 0); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | $bits /= pow($base, $pow); |
| 55 | 55 | |
| 56 | - return round($bits, $precision) . ' ' . $units[$pow]; |
|
| 56 | + return round($bits, $precision).' '.$units[$pow]; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // ---- Define Reletionships ---- |
@@ -11,8 +11,8 @@ discard block |
||
| 11 | 11 | class ApiController extends Controller |
| 12 | 12 | { |
| 13 | 13 | /** |
| 14 | - * Get info about the install |
|
| 15 | - */ |
|
| 14 | + * Get info about the install |
|
| 15 | + */ |
|
| 16 | 16 | public function get_info() |
| 17 | 17 | { |
| 18 | 18 | $versions['git'] = `git rev-parse --short HEAD`; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * Get statistics about the install |
| 31 | - **/ |
|
| 31 | + **/ |
|
| 32 | 32 | public function get_stats() |
| 33 | 33 | { |
| 34 | 34 | $stats['devices'] = DB::select('SELECT COUNT(device_id) AS `total` FROM `devices`')[0]->total; |
@@ -3,10 +3,8 @@ |
||
| 3 | 3 | namespace App\Api\Controllers; |
| 4 | 4 | |
| 5 | 5 | use DB; |
| 6 | -use App\User; |
|
| 7 | 6 | use App\Device; |
| 8 | 7 | use App\Port; |
| 9 | -use Illuminate\Http\Request; |
|
| 10 | 8 | |
| 11 | 9 | class ApiController extends Controller |
| 12 | 10 | { |
@@ -21,6 +21,6 @@ |
||
| 21 | 21 | public function about() { |
| 22 | 22 | $versions = $this->api->be(auth()->user())->get('/api/info'); |
| 23 | 23 | $stats = $this->api->be(auth()->user())->get('/api/stats'); |
| 24 | - return view('general.about', ['versions'=>$versions,'stats'=>$stats]); |
|
| 24 | + return view('general.about', ['versions'=>$versions, 'stats'=>$stats]); |
|
| 25 | 25 | } |
| 26 | 26 | } |