@@ -25,7 +25,6 @@ |
||
| 25 | 25 | |
| 26 | 26 | namespace App\Console\Commands; |
| 27 | 27 | |
| 28 | -use App\Events\ListDevices; |
|
| 29 | 28 | use App\Models\Device; |
| 30 | 29 | use Illuminate\Console\Command; |
| 31 | 30 | |
@@ -56,7 +56,8 @@ discard block |
||
| 56 | 56 | if ($this->option('pop') || $delete) { |
| 57 | 57 | if ($delete) { |
| 58 | 58 | $device = Device::find($delete); |
| 59 | - } else { |
|
| 59 | + } |
|
| 60 | + else { |
|
| 60 | 61 | $device = Device::orderBy('device_id', 'desc')->first(); |
| 61 | 62 | } |
| 62 | 63 | |
@@ -70,13 +71,16 @@ discard block |
||
| 70 | 71 | if ($id == 'all') { |
| 71 | 72 | $this->info('all'); |
| 72 | 73 | $devices = Device::all(); |
| 73 | - } elseif ($this->option('push')) { |
|
| 74 | + } |
|
| 75 | + elseif ($this->option('push')) { |
|
| 74 | 76 | $this->info('push'); |
| 75 | 77 | $devices = [new Device(['hostname' => 'Mockery'])]; |
| 76 | - } elseif ($id === null) { |
|
| 78 | + } |
|
| 79 | + elseif ($id === null) { |
|
| 77 | 80 | $this->info('first'); |
| 78 | 81 | $devices = [Device::first()]; |
| 79 | - } else { |
|
| 82 | + } |
|
| 83 | + else { |
|
| 80 | 84 | $this->info('findOrNew'); |
| 81 | 85 | $devices = [Device::findOrNew($id)]; |
| 82 | 86 | } |
@@ -22,7 +22,8 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | if ($request->user()->hasGlobalRead()) { |
| 24 | 24 | $devices = Device::query(); |
| 25 | - } else { |
|
| 25 | + } |
|
| 26 | + else { |
|
| 26 | 27 | $devices = $request->user()->devices(); |
| 27 | 28 | } |
| 28 | 29 | |
@@ -67,7 +68,8 @@ discard block |
||
| 67 | 68 | { |
| 68 | 69 | if ($request->user()->hasGlobalRead()) { |
| 69 | 70 | $device = Device::find($id); |
| 70 | - } else { |
|
| 71 | + } |
|
| 72 | + else { |
|
| 71 | 73 | $user = User::find($request->user()->user_id); |
| 72 | 74 | $device = $user->devices()->find($id); |
| 73 | 75 | } |