@@ -19,9 +19,8 @@ |
||
| 19 | 19 | |
| 20 | 20 | use Illuminate\Http\Request; |
| 21 | 21 | |
| 22 | -use App\Http\Requests; |
|
| 23 | -use App\Http\Controllers\Controller; |
|
| 24 | 22 | use App\DataTables\AlertsDataTable; |
| 23 | +use App\Http\Controllers\Controller; |
|
| 25 | 24 | |
| 26 | 25 | class AlertsController extends Controller |
| 27 | 26 | { |
@@ -42,13 +42,13 @@ |
||
| 42 | 42 | @else |
| 43 | 43 | <div class="label label-primary">UNKNOWN</div> |
| 44 | 44 | @endif') |
| 45 | - ->editColumn('rule.name', function ($this) { |
|
| 46 | - return '<a href="' . url("alerting/rules/".$this['rule']['id']) . '">' . $this['rule']['name'] . '</a>'; |
|
| 45 | + ->editColumn('rule.name', function($this) { |
|
| 46 | + return '<a href="'.url("alerting/rules/".$this['rule']['id']).'">'.$this['rule']['name'].'</a>'; |
|
| 47 | 47 | }) |
| 48 | - ->editColumn('device.hostname', function ($this) { |
|
| 49 | - return '<a href="' . url("devices/".$this['device']['device_id']) . '">' . $this['device']['hostname'] . '</a>'; |
|
| 48 | + ->editColumn('device.hostname', function($this) { |
|
| 49 | + return '<a href="'.url("devices/".$this['device']['device_id']).'">'.$this['device']['hostname'].'</a>'; |
|
| 50 | 50 | }) |
| 51 | - ->addColumn('actions', function ($this) { |
|
| 51 | + ->addColumn('actions', function($this) { |
|
| 52 | 52 | return ''; |
| 53 | 53 | }) |
| 54 | 54 | ->make(true); |
@@ -25,12 +25,11 @@ |
||
| 25 | 25 | |
| 26 | 26 | namespace App\Api\Controllers\Alerting; |
| 27 | 27 | |
| 28 | -use App\Api\Transformers\AlertsTransformer; |
|
| 28 | +use App\Api\Controllers\Controller; |
|
| 29 | +use App\Models\Alerting\Alert; |
|
| 29 | 30 | use Dingo\Api\Http; |
| 30 | 31 | use Dingo\Api\Routing\Helpers; |
| 31 | 32 | use Illuminate\Http\Request; |
| 32 | -use App\Api\Controllers\Controller; |
|
| 33 | -use App\Models\Alerting\Alert; |
|
| 34 | 33 | |
| 35 | 34 | class AlertsController extends Controller |
| 36 | 35 | { |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | - * @return \Illuminate\Database\Eloquent\Relations\belongsTo |
|
| 67 | + * @return \Illuminate\Database\Eloquent\Relations\HasMany |
|
| 68 | 68 | */ |
| 69 | 69 | public function device() |
| 70 | 70 | { |
@@ -26,7 +26,6 @@ |
||
| 26 | 26 | namespace App\Models\Alerting; |
| 27 | 27 | |
| 28 | 28 | use Illuminate\Database\Eloquent\Model; |
| 29 | -use Illuminate\Database\Eloquent\Builder; |
|
| 30 | 29 | |
| 31 | 30 | |
| 32 | 31 | /** |
@@ -73,8 +73,8 @@ |
||
| 73 | 73 | /** |
| 74 | 74 | * |
| 75 | 75 | */ |
| 76 | - public function scopeActive(Builder $query) |
|
| 77 | - { |
|
| 78 | - return $query->where('state', '!=', '0'); |
|
| 79 | - } |
|
| 76 | + public function scopeActive(Builder $query) |
|
| 77 | + { |
|
| 78 | + return $query->where('state', '!=', '0'); |
|
| 79 | + } |
|
| 80 | 80 | } |
@@ -39,12 +39,12 @@ |
||
| 39 | 39 | public function transform(Alerts $alerts) |
| 40 | 40 | { |
| 41 | 41 | return [ |
| 42 | - 'id' => (int)$alerts->id, |
|
| 43 | - 'device_id' => (int)$alerts->device_id, |
|
| 44 | - 'rule_id' => (int)$alerts->rule_id, |
|
| 45 | - 'state' => (int)$alerts->state, |
|
| 46 | - 'alerted' => (int)$alerts->alerted, |
|
| 47 | - 'open' => (int)$alerts->open, |
|
| 42 | + 'id' => (int) $alerts->id, |
|
| 43 | + 'device_id' => (int) $alerts->device_id, |
|
| 44 | + 'rule_id' => (int) $alerts->rule_id, |
|
| 45 | + 'state' => (int) $alerts->state, |
|
| 46 | + 'alerted' => (int) $alerts->alerted, |
|
| 47 | + 'open' => (int) $alerts->open, |
|
| 48 | 48 | 'timestamp' => $alerts->timestamp, |
| 49 | 49 | ]; |
| 50 | 50 | } |