@@ -54,14 +54,16 @@ discard block |
||
| 54 | 54 | // set realname |
| 55 | 55 | if ($this->option('realname')) { |
| 56 | 56 | $user->realname = $this->option('realname'); |
| 57 | - } else { |
|
| 57 | + } |
|
| 58 | + else { |
|
| 58 | 59 | $user->realname = $this->ask('Real Name'); |
| 59 | 60 | } |
| 60 | 61 | |
| 61 | 62 | // set email |
| 62 | 63 | if ($this->option('email')) { |
| 63 | 64 | $user->email = $this->option('email'); |
| 64 | - } else { |
|
| 65 | + } |
|
| 66 | + else { |
|
| 65 | 67 | $user->email = $this->ask('Email'); |
| 66 | 68 | } |
| 67 | 69 | |
@@ -77,14 +79,16 @@ discard block |
||
| 77 | 79 | // set password |
| 78 | 80 | if ($this->argument('password')) { |
| 79 | 81 | $user->password = $this->argument('password'); |
| 80 | - } else { |
|
| 82 | + } |
|
| 83 | + else { |
|
| 81 | 84 | $user->password = $this->secret('Password'); |
| 82 | 85 | } |
| 83 | 86 | |
| 84 | 87 | // save user |
| 85 | 88 | if ($user->save()) { |
| 86 | 89 | $this->info('User '.$user->username.' created.'); |
| 87 | - } else { |
|
| 90 | + } |
|
| 91 | + else { |
|
| 88 | 92 | $this->error('Failed to create user '.$user->username); |
| 89 | 93 | } |
| 90 | 94 | } |
@@ -23,7 +23,8 @@ discard block |
||
| 23 | 23 | $per_page = $request->per_page ?: 25; |
| 24 | 24 | if ($request->user()->hasGlobalRead()) { |
| 25 | 25 | $devices = Device::paginate($per_page); |
| 26 | - } else { |
|
| 26 | + } |
|
| 27 | + else { |
|
| 27 | 28 | $devices = User::find($request->user()->user_id)->devices()->paginate($per_page); |
| 28 | 29 | } |
| 29 | 30 | return $devices; |
@@ -60,7 +61,8 @@ discard block |
||
| 60 | 61 | { |
| 61 | 62 | if ($request->user()->hasGlobalRead()) { |
| 62 | 63 | $device = Device::find($id); |
| 63 | - } else { |
|
| 64 | + } |
|
| 65 | + else { |
|
| 64 | 66 | $user = User::find($request->user()->user_id); |
| 65 | 67 | $device = $user->devices()->find($id); |
| 66 | 68 | } |