@@ -72,8 +72,8 @@ |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
75 | - * check database type. If SQLite, then create the database file. |
|
76 | - */ |
|
75 | + * check database type. If SQLite, then create the database file. |
|
76 | + */ |
|
77 | 77 | private function sqlite() |
78 | 78 | { |
79 | 79 | if(DB::connection() instanceof SQLiteConnection) { |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | */ |
30 | 30 | private function migrate() |
31 | 31 | { |
32 | - try{ |
|
33 | - Artisan::call('migrate', ["--force"=> true ]); |
|
32 | + try { |
|
33 | + Artisan::call('migrate', ["--force"=> true]); |
|
34 | 34 | } |
35 | - catch(Exception $e){ |
|
35 | + catch (Exception $e) { |
|
36 | 36 | return $this->response($e->getMessage()); |
37 | 37 | } |
38 | 38 | |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | */ |
47 | 47 | private function seed() |
48 | 48 | { |
49 | - try{ |
|
49 | + try { |
|
50 | 50 | Artisan::call('db:seed'); |
51 | 51 | } |
52 | - catch(Exception $e){ |
|
52 | + catch (Exception $e) { |
|
53 | 53 | return $this->response($e->getMessage()); |
54 | 54 | } |
55 | 55 | |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | */ |
77 | 77 | private function sqlite() |
78 | 78 | { |
79 | - if(DB::connection() instanceof SQLiteConnection) { |
|
79 | + if (DB::connection() instanceof SQLiteConnection) { |
|
80 | 80 | $database = DB::connection()->getDatabaseName(); |
81 | - if(!file_exists($database)) { |
|
81 | + if (!file_exists($database)) { |
|
82 | 82 | touch($database); |
83 | 83 | DB::reconnect(Config::get('database.default')); |
84 | 84 | } |
@@ -31,8 +31,7 @@ discard block |
||
31 | 31 | { |
32 | 32 | try{ |
33 | 33 | Artisan::call('migrate', ["--force"=> true ]); |
34 | - } |
|
35 | - catch(Exception $e){ |
|
34 | + } catch(Exception $e){ |
|
36 | 35 | return $this->response($e->getMessage()); |
37 | 36 | } |
38 | 37 | |
@@ -48,8 +47,7 @@ discard block |
||
48 | 47 | { |
49 | 48 | try{ |
50 | 49 | Artisan::call('db:seed'); |
51 | - } |
|
52 | - catch(Exception $e){ |
|
50 | + } catch(Exception $e){ |
|
53 | 51 | return $this->response($e->getMessage()); |
54 | 52 | } |
55 | 53 |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | |
43 | 43 | private function accountSummary() |
44 | 44 | { |
45 | - $list = [ 'total' => 0, 'summary' => []]; |
|
45 | + $list = ['total' => 0, 'summary' => []]; |
|
46 | 46 | $categories = Category::orderBy('name', 'asc')->get(); |
47 | 47 | foreach ($categories as $category) { |
48 | 48 | $count = Account::where('category_id', $category->id)->count(); |
49 | 49 | if ($count) { |
50 | - $list['summary'][]= [ |
|
50 | + $list['summary'][] = [ |
|
51 | 51 | 'count' => $count, |
52 | 52 | 'text' => $category->name |
53 | 53 | ]; |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | |
60 | 60 | private function groupSummary() |
61 | 61 | { |
62 | - $list = [ 'total' => 0, 'summary' => []]; |
|
62 | + $list = ['total' => 0, 'summary' => []]; |
|
63 | 63 | $groups = Group::orderBy('name', 'asc')->get(); |
64 | 64 | foreach ($groups as $group) { |
65 | 65 | $count = Account::where('group_id', $group->id)->count(); |
66 | - $list['summary'][]= [ |
|
66 | + $list['summary'][] = [ |
|
67 | 67 | 'count' => $count, |
68 | 68 | 'text' => $group->name |
69 | 69 | ]; |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | |
75 | 75 | private function categorySummary() |
76 | 76 | { |
77 | - $list = [ 'total' => 0, 'summary' => []]; |
|
77 | + $list = ['total' => 0, 'summary' => []]; |
|
78 | 78 | $categories = Category::get(); |
79 | 79 | foreach ($categories as $category) { |
80 | 80 | $count = Account::where('category_id', $category->id)->count(); |
81 | - $list['summary'][]= [ |
|
81 | + $list['summary'][] = [ |
|
82 | 82 | 'count' => $count, |
83 | 83 | 'text' => $category->name |
84 | 84 | ]; |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | |
90 | 90 | private function listSummary() |
91 | 91 | { |
92 | - $list = [ 'total' => 0, 'summary' => [] ]; |
|
93 | - $types = [ 'domain', 'url' ]; |
|
92 | + $list = ['total' => 0, 'summary' => []]; |
|
93 | + $types = ['domain', 'url']; |
|
94 | 94 | foreach ($types as $type) { |
95 | 95 | $count = ProxyListItem::where('type', $type)->count(); |
96 | 96 | if ($count) { |
97 | - $list['summary'][]= [ |
|
97 | + $list['summary'][] = [ |
|
98 | 98 | 'count' => $count, |
99 | 99 | 'text' => "{$type}s" |
100 | 100 | ]; |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | |
107 | 107 | private function userSummary() |
108 | 108 | { |
109 | - $list = [ 'total' => 0, 'summary' => []]; |
|
109 | + $list = ['total' => 0, 'summary' => []]; |
|
110 | 110 | foreach (User::USER_LEVEL as $id => $level) { |
111 | 111 | $count = User::where('level', $id)->count(); |
112 | 112 | if ($count) { |
113 | - $list['summary'][]= [ |
|
113 | + $list['summary'][] = [ |
|
114 | 114 | 'count' => $count, |
115 | 115 | 'text' => $level['text'] |
116 | 116 | ]; |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | public function search(&$entities, $type = null, $search = null) |
11 | 11 | { |
12 | - $reflection = new ReflectionProperty($entities, 'model'); |
|
12 | + $reflection = new ReflectionProperty($entities, 'model'); |
|
13 | 13 | $reflection->setAccessible(true); |
14 | 14 | $classname = $reflection->getValue($entities); |
15 | 15 | |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | $criteria = explode(' ', $search); |
21 | 21 | $columns = $classname::SEARCH_CRITERIA[$type]; |
22 | 22 | |
23 | - $entities = $entities->where( function($q) use ($columns, $criteria) { |
|
23 | + $entities = $entities->where(function($q) use ($columns, $criteria) { |
|
24 | 24 | foreach ($columns as $column) { |
25 | 25 | if (is_array($column)) { |
26 | 26 | $relation = $column; |
27 | - foreach($relation as $table => $column) { |
|
27 | + foreach ($relation as $table => $column) { |
|
28 | 28 | $q->whereHas($table, |
29 | 29 | function($query) use ($column, $criteria) { |
30 | - foreach($criteria as $value) { |
|
30 | + foreach ($criteria as $value) { |
|
31 | 31 | $query->orWhere($column, 'LIKE', $value); |
32 | 32 | } |
33 | 33 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } else { |
37 | 37 | $q->orWhere( |
38 | 38 | function($query) use ($column, $criteria) { |
39 | - foreach($criteria as $value) { |
|
39 | + foreach ($criteria as $value) { |
|
40 | 40 | $query->orWhere($column, 'LIKE', $value); |
41 | 41 | } |
42 | 42 | } |
@@ -54,7 +54,7 @@ |
||
54 | 54 | { |
55 | 55 | $router->group([ |
56 | 56 | 'namespace' => $this->namespace, 'middleware' => 'web', |
57 | - ], function ($router) { |
|
57 | + ], function($router) { |
|
58 | 58 | require app_path('Http/routes.php'); |
59 | 59 | }); |
60 | 60 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | | |
12 | 12 | */ |
13 | 13 | |
14 | -Route::group(['middleware' => 'installed'], function () { |
|
14 | +Route::group(['middleware' => 'installed'], function() { |
|
15 | 15 | |
16 | 16 | Route::auth(); |
17 | 17 |
@@ -27,7 +27,7 @@ |
||
27 | 27 | } |
28 | 28 | } |
29 | 29 | $view->with('enable', $enable) |
30 | - ->with('title', $title) |
|
31 | - ->with('contents', $contents); |
|
30 | + ->with('title', $title) |
|
31 | + ->with('contents', $contents); |
|
32 | 32 | } |
33 | 33 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | $contents = ''; |
21 | 21 | if (config('kleis.legal_notice')) { |
22 | 22 | $mdfile = public_path('markdown/legal/'.config('kleis.legal_notice').'-'.config('app.locale').'.md'); |
23 | - if (file_exists($mdfile)){ |
|
23 | + if (file_exists($mdfile)) { |
|
24 | 24 | list($title, $text) = explode(PHP_EOL, file_get_contents($mdfile), 2); |
25 | 25 | $enable = true; |
26 | 26 | $contents = Markdown::parse($text)->toHtml(); |
@@ -62,7 +62,7 @@ |
||
62 | 62 | public function handle() |
63 | 63 | { |
64 | 64 | $accounts = Account::where('status', Account::ACCOUNT_ENABLE) |
65 | - ->orderBy('netlogin', 'desc')->get(); |
|
65 | + ->orderBy('netlogin', 'desc')->get(); |
|
66 | 66 | |
67 | 67 | if ($accounts->isEmpty()) { |
68 | 68 | $this->info("No accounts to export"); |
@@ -55,32 +55,32 @@ |
||
55 | 55 | * |
56 | 56 | * @return mixed |
57 | 57 | */ |
58 | - public function handle() |
|
59 | - { |
|
60 | - $categories = Category::get(); |
|
58 | + public function handle() |
|
59 | + { |
|
60 | + $categories = Category::get(); |
|
61 | 61 | |
62 | - if ($categories->isEmpty()) { |
|
63 | - $this->info("No categories to export"); |
|
64 | - return; |
|
65 | - } |
|
62 | + if ($categories->isEmpty()) { |
|
63 | + $this->info("No categories to export"); |
|
64 | + return; |
|
65 | + } |
|
66 | 66 | |
67 | - foreach ($categories as $category){ |
|
68 | - $name = static::stringNormalise($category->name); |
|
69 | - $filename = "{$this->exportFolder}/{$name}{$this->exportFileExt}"; |
|
70 | - $accounts = Account::where('status', Account::ACCOUNT_ENABLE) |
|
67 | + foreach ($categories as $category){ |
|
68 | + $name = static::stringNormalise($category->name); |
|
69 | + $filename = "{$this->exportFolder}/{$name}{$this->exportFileExt}"; |
|
70 | + $accounts = Account::where('status', Account::ACCOUNT_ENABLE) |
|
71 | 71 | ->where('category_id', $category->id) |
72 | 72 | ->orderBy('netlogin', 'desc') |
73 | 73 | ->get(); |
74 | - Storage::disk('export')->put($filename, ''); |
|
75 | - $count = count($accounts); |
|
76 | - $bar = $this->output->createProgressBar($count); |
|
77 | - foreach ($accounts as $account) { |
|
78 | - Storage::disk('export')->prepend($filename, "{$account->netlogin}:{$account->netpass}"); |
|
79 | - $bar->advance(); |
|
80 | - } |
|
81 | - $bar->finish(); |
|
82 | - $url = Storage::disk('export')->path($filename); |
|
83 | - $this->info("\n{$count} accounts '{$category->name}' exported into file '{$url}'"); |
|
84 | - } |
|
85 | - } |
|
74 | + Storage::disk('export')->put($filename, ''); |
|
75 | + $count = count($accounts); |
|
76 | + $bar = $this->output->createProgressBar($count); |
|
77 | + foreach ($accounts as $account) { |
|
78 | + Storage::disk('export')->prepend($filename, "{$account->netlogin}:{$account->netpass}"); |
|
79 | + $bar->advance(); |
|
80 | + } |
|
81 | + $bar->finish(); |
|
82 | + $url = Storage::disk('export')->path($filename); |
|
83 | + $this->info("\n{$count} accounts '{$category->name}' exported into file '{$url}'"); |
|
84 | + } |
|
85 | + } |
|
86 | 86 | } |
@@ -64,7 +64,7 @@ |
||
64 | 64 | return; |
65 | 65 | } |
66 | 66 | |
67 | - foreach ($categories as $category){ |
|
67 | + foreach ($categories as $category) { |
|
68 | 68 | $name = static::stringNormalise($category->name); |
69 | 69 | $filename = "{$this->exportFolder}/{$name}{$this->exportFileExt}"; |
70 | 70 | $accounts = Account::where('status', Account::ACCOUNT_ENABLE) |
@@ -55,32 +55,32 @@ |
||
55 | 55 | * |
56 | 56 | * @return mixed |
57 | 57 | */ |
58 | - public function handle() |
|
59 | - { |
|
60 | - $groups = Group::get(); |
|
58 | + public function handle() |
|
59 | + { |
|
60 | + $groups = Group::get(); |
|
61 | 61 | |
62 | - if ($groups->isEmpty()) { |
|
63 | - $this->info("No groups to export"); |
|
64 | - return; |
|
65 | - } |
|
62 | + if ($groups->isEmpty()) { |
|
63 | + $this->info("No groups to export"); |
|
64 | + return; |
|
65 | + } |
|
66 | 66 | |
67 | - foreach ($groups as $group){ |
|
68 | - $name = static::stringNormalise($group->name); |
|
69 | - $filename = "{$this->exportFolder}/{$name}{$this->exportFileExt}"; |
|
70 | - $accounts = Account::where('status', Account::ACCOUNT_ENABLE) |
|
67 | + foreach ($groups as $group){ |
|
68 | + $name = static::stringNormalise($group->name); |
|
69 | + $filename = "{$this->exportFolder}/{$name}{$this->exportFileExt}"; |
|
70 | + $accounts = Account::where('status', Account::ACCOUNT_ENABLE) |
|
71 | 71 | ->where('group_id', $group->id) |
72 | 72 | ->orderBy('netlogin', 'desc') |
73 | 73 | ->get(); |
74 | - Storage::disk('export')->put($filename, ''); |
|
75 | - $count = count($accounts); |
|
76 | - $bar = $this->output->createProgressBar($count); |
|
77 | - foreach ($accounts as $account) { |
|
78 | - Storage::disk('export')->prepend($filename, "{$account->netlogin}:{$account->netpass}"); |
|
79 | - $bar->advance(); |
|
80 | - } |
|
81 | - $bar->finish(); |
|
82 | - $url = Storage::disk('export')->path($filename); |
|
83 | - $this->info("\n{$count} accounts '{$group->name}' exported into file '{$url}'"); |
|
84 | - } |
|
85 | - } |
|
74 | + Storage::disk('export')->put($filename, ''); |
|
75 | + $count = count($accounts); |
|
76 | + $bar = $this->output->createProgressBar($count); |
|
77 | + foreach ($accounts as $account) { |
|
78 | + Storage::disk('export')->prepend($filename, "{$account->netlogin}:{$account->netpass}"); |
|
79 | + $bar->advance(); |
|
80 | + } |
|
81 | + $bar->finish(); |
|
82 | + $url = Storage::disk('export')->path($filename); |
|
83 | + $this->info("\n{$count} accounts '{$group->name}' exported into file '{$url}'"); |
|
84 | + } |
|
85 | + } |
|
86 | 86 | } |
@@ -64,7 +64,7 @@ |
||
64 | 64 | return; |
65 | 65 | } |
66 | 66 | |
67 | - foreach ($groups as $group){ |
|
67 | + foreach ($groups as $group) { |
|
68 | 68 | $name = static::stringNormalise($group->name); |
69 | 69 | $filename = "{$this->exportFolder}/{$name}{$this->exportFileExt}"; |
70 | 70 | $accounts = Account::where('status', Account::ACCOUNT_ENABLE) |