@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace App\Api\Controllers; |
| 4 | 4 | |
| 5 | 5 | use DB; |
| 6 | -use App\Http\Requests; |
|
| 7 | 6 | use Illuminate\Http\Request; |
| 8 | 7 | |
| 9 | 8 | class ApiController extends Controller |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | ->get(); |
| 20 | 20 | } |
| 21 | 21 | else { |
| 22 | - $tmp_devices = DB::table('devices') |
|
| 22 | + $tmp_devices = DB::table('devices') |
|
| 23 | 23 | ->select(DB::raw('DISTINCT(`devices`.`device_id`),`devices`.*')) |
| 24 | 24 | ->leftJoin('devices_perms AS DP', 'devices.device_id', '=', 'DP.device_id') |
| 25 | 25 | ->where('DP.user_id', '=', $request->user()->user_id) |
@@ -17,8 +17,7 @@ discard block |
||
| 17 | 17 | $tmp_devices = DB::table('devices') |
| 18 | 18 | ->select(DB::raw('DISTINCT(`devices`.`device_id`),`devices`.*')) |
| 19 | 19 | ->get(); |
| 20 | - } |
|
| 21 | - else { |
|
| 20 | + } else { |
|
| 22 | 21 | $tmp_devices = DB::table('devices') |
| 23 | 22 | ->select(DB::raw('DISTINCT(`devices`.`device_id`),`devices`.*')) |
| 24 | 23 | ->leftJoin('devices_perms AS DP', 'devices.device_id', '=', 'DP.device_id') |
@@ -30,8 +29,7 @@ discard block |
||
| 30 | 29 | if ($device->status == 0) { |
| 31 | 30 | $visual_status = 'danger'; |
| 32 | 31 | $msg = $device->status_reason; |
| 33 | - } |
|
| 34 | - else { |
|
| 32 | + } else { |
|
| 35 | 33 | $visual_status = 'success'; |
| 36 | 34 | $msg = 'up'; |
| 37 | 35 | } |
@@ -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 | { |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | |
| 17 | 17 | try { |
| 18 | 18 | // attempt to verify the credentials and create a token for the user |
| 19 | - if (! $token = JWTAuth::attempt($credentials)) { |
|
| 19 | + if (!$token = JWTAuth::attempt($credentials)) { |
|
| 20 | 20 | return response()->json(['error' => 'invalid_credentials'], 401); |
| 21 | 21 | } |
| 22 | 22 | } catch (JWTException $e) { |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | | |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -Route::group(['middleware' => ['web']], function () { |
|
| 14 | +Route::group(['middleware' => ['web']], function() { |
|
| 15 | 15 | Route::auth(); |
| 16 | 16 | Route::get('/', 'HomeController@index'); |
| 17 | 17 | Route::get('/home', 'HomeController@index'); |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | }); |
| 20 | 20 | |
| 21 | 21 | $api = app('Dingo\Api\Routing\Router'); |
| 22 | -$api->version('v1', function ($api) { |
|
| 23 | - $api->post('auth', 'App\Api\Controllers\APIAuthController@authenticate'); |
|
| 24 | - $api->group(['middleware' => 'api.auth'], function ($api) { |
|
| 22 | +$api->version('v1', function($api) { |
|
| 23 | + $api->post('auth', 'App\Api\Controllers\APIAuthController@authenticate'); |
|
| 24 | + $api->group(['middleware' => 'api.auth'], function($api) { |
|
| 25 | 25 | $api->get('devices', 'App\Api\Controllers\APIController@list_devices'); |
| 26 | 26 | }); |
| 27 | 27 | }); |
@@ -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 | } |