| @@ -58,7 +58,7 @@ discard block | ||
| 58 | 58 | * Store a newly created resource in storage. | 
| 59 | 59 | * | 
| 60 | 60 | * @param \Illuminate\Http\Request $request | 
| 61 | - * @return \Illuminate\Http\Response | |
| 61 | + * @return null|\Dingo\Api\Http\Response | |
| 62 | 62 | */ | 
| 63 | 63 | public function store(Request $request) | 
| 64 | 64 |      { | 
| @@ -98,7 +98,7 @@ discard block | ||
| 98 | 98 | * | 
| 99 | 99 | * @param \Illuminate\Http\Request $request | 
| 100 | 100 | * @param int $id | 
| 101 | - * @return \Illuminate\Http\Response | |
| 101 | + * @return null|\Dingo\Api\Http\Response | |
| 102 | 102 | */ | 
| 103 | 103 | public function update(Request $request, $id) | 
| 104 | 104 |      { | 
| @@ -119,7 +119,7 @@ discard block | ||
| 119 | 119 | * | 
| 120 | 120 | * @param Request $request | 
| 121 | 121 | * @param int $id | 
| 122 | - * @return \Illuminate\Http\Response | |
| 122 | + * @return null|\Dingo\Api\Http\Response | |
| 123 | 123 | */ | 
| 124 | 124 | public function destroy(Request $request, $id) | 
| 125 | 125 |      { | 
| @@ -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 | } |