@@ -67,11 +67,11 @@ |
||
| 67 | 67 | } |
| 68 | 68 | else { |
| 69 | 69 | $user = User::find($request->user()->user_id); |
| 70 | - $device = $user->devices()->find($id); |
|
| 70 | + $device = $user->devices()->find($id); |
|
| 71 | 71 | } |
| 72 | 72 | // morph the data as required |
| 73 | 73 | if ($request->query('displayFormat') == 'link') { |
| 74 | - return '<a href="'.url('/devices/').$device->deviceId.'">'.$device->hostname.'</a>'; |
|
| 74 | + return '<a href="' . url('/devices/') . $device->deviceId . '">' . $device->hostname . '</a>'; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | return $device; |
@@ -22,8 +22,7 @@ discard block |
||
| 22 | 22 | // fetch devices from the database |
| 23 | 23 | if ($request->user()->hasGlobalRead()) { |
| 24 | 24 | $devices = Device::all(); |
| 25 | - } |
|
| 26 | - else { |
|
| 25 | + } else { |
|
| 27 | 26 | $devices = User::find($request->user()->user_id)->devices()->get(); |
| 28 | 27 | } |
| 29 | 28 | // morph the data as required |
@@ -64,8 +63,7 @@ discard block |
||
| 64 | 63 | { |
| 65 | 64 | if ($request->user()->hasGlobalRead()) { |
| 66 | 65 | $device = Device::find($id); |
| 67 | - } |
|
| 68 | - else { |
|
| 66 | + } else { |
|
| 69 | 67 | $user = User::find($request->user()->user_id); |
| 70 | 68 | $device = $user->devices()->find($id); |
| 71 | 69 | } |
@@ -99,8 +99,8 @@ |
||
| 99 | 99 | if (!empty($value)) { |
| 100 | 100 | try { |
| 101 | 101 | return unserialize($value); |
| 102 | - } catch(\Exception $e) { |
|
| 103 | - if(starts_with($e->getMessage(), 'unserialize():')) { |
|
| 102 | + } catch (\Exception $e) { |
|
| 103 | + if (starts_with($e->getMessage(), 'unserialize():')) { |
|
| 104 | 104 | return $value; |
| 105 | 105 | } else { |
| 106 | 106 | throw $e; |
@@ -28,6 +28,6 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | public function handle() |
| 30 | 30 | { |
| 31 | - $this->comment(PHP_EOL.Inspiring::quote().PHP_EOL); |
|
| 31 | + $this->comment(PHP_EOL . Inspiring::quote() . PHP_EOL); |
|
| 32 | 32 | } |
| 33 | 33 | } |
@@ -56,16 +56,14 @@ discard block |
||
| 56 | 56 | // set realname |
| 57 | 57 | if ($this->option('realname')) { |
| 58 | 58 | $user->realname = $this->option('realname'); |
| 59 | - } |
|
| 60 | - else { |
|
| 59 | + } else { |
|
| 61 | 60 | $user->realname = $this->ask('Real Name'); |
| 62 | 61 | } |
| 63 | 62 | |
| 64 | 63 | // set email |
| 65 | 64 | if ($this->option('email')) { |
| 66 | 65 | $user->email = $this->option('email'); |
| 67 | - } |
|
| 68 | - else { |
|
| 66 | + } else { |
|
| 69 | 67 | $user->email = $this->ask('Email'); |
| 70 | 68 | } |
| 71 | 69 | |
@@ -81,16 +79,14 @@ discard block |
||
| 81 | 79 | // set password |
| 82 | 80 | if ($this->argument('password')) { |
| 83 | 81 | $user->password = bcrypt($this->argument('password')); |
| 84 | - } |
|
| 85 | - else { |
|
| 82 | + } else { |
|
| 86 | 83 | $user->password = bcrypt($this->secret('Password')); |
| 87 | 84 | } |
| 88 | 85 | |
| 89 | 86 | // save user |
| 90 | 87 | if ($user->save()) { |
| 91 | 88 | $this->info('User ' . $user->username . ' created.'); |
| 92 | - } |
|
| 93 | - else { |
|
| 89 | + } else { |
|
| 94 | 90 | $this->error('Failed to create user ' . $user->username); |
| 95 | 91 | } |
| 96 | 92 | } |
@@ -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 | } |
@@ -15,13 +15,13 @@ |
||
| 15 | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | 16 | */ |
| 17 | 17 | /** |
| 18 | - * SettingsServiceProvider.php |
|
| 19 | - * |
|
| 20 | - * @package LibreNMS |
|
| 21 | - * @author Tony Murray <[email protected]> |
|
| 22 | - * @copyright 2016 Tony Murray |
|
| 23 | - * @license @license http://opensource.org/licenses/GPL-3.0 GNU Public License v3 or later |
|
| 24 | - */ |
|
| 18 | + * SettingsServiceProvider.php |
|
| 19 | + * |
|
| 20 | + * @package LibreNMS |
|
| 21 | + * @author Tony Murray <[email protected]> |
|
| 22 | + * @copyright 2016 Tony Murray |
|
| 23 | + * @license @license http://opensource.org/licenses/GPL-3.0 GNU Public License v3 or later |
|
| 24 | + */ |
|
| 25 | 25 | |
| 26 | 26 | namespace App\Providers; |
| 27 | 27 | |
@@ -24,8 +24,7 @@ |
||
| 24 | 24 | { |
| 25 | 25 | $devices = []; |
| 26 | 26 | $ports = []; |
| 27 | - } |
|
| 28 | - else { |
|
| 27 | + } else { |
|
| 29 | 28 | $devices = User::find($request->user()->user_id)->devices()->count(); |
| 30 | 29 | $ports = User::find($request->user()->user_id)->ports()->count(); |
| 31 | 30 | } |