@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | |
8 | 8 | trait ConnectionTrait |
9 | 9 | { |
10 | - public function setConnection($conn='mysql', $db='enso') |
|
10 | + public function setConnection($conn = 'mysql', $db = 'enso') |
|
11 | 11 | { |
12 | - if($conn == Connections::Tenant) { |
|
12 | + if ($conn == Connections::Tenant) { |
|
13 | 13 | $key = 'database.connections.tenant.database'; |
14 | 14 | config([$key => $db]); |
15 | 15 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | { |
22 | 22 | $conn = \Session::get('conn'); |
23 | 23 | $db = \Session::get('db'); |
24 | - if($conn == 'tenant') { |
|
24 | + if ($conn == 'tenant') { |
|
25 | 25 | $key = 'database.connections.tenant.database'; |
26 | 26 | $value = $db; |
27 | 27 | config([$key => $value]); |
@@ -111,18 +111,18 @@ |
||
111 | 111 | // change database to use |
112 | 112 | public function changedb(Request $request) { |
113 | 113 | $company_id = $request->get('comid'); |
114 | - if(!empty($company_id)){ |
|
114 | + if (!empty($company_id)) { |
|
115 | 115 | $db = Connections::Tenant.$company_id; |
116 | 116 | $this->setConnection(Connections::Tenant, $db); |
117 | 117 | } else { |
118 | 118 | $this->setConnection('mysql'); |
119 | 119 | } |
120 | - $conn = $this->getConnection(); |
|
120 | + $conn = $this->getConnection(); |
|
121 | 121 | return $conn; |
122 | 122 | } |
123 | 123 | |
124 | 124 | // get companies of user. |
125 | - public function getDB(){ |
|
125 | + public function getDB() { |
|
126 | 126 | $user = Auth::user(); |
127 | 127 | $companies = $user->person->companies()->get(); |
128 | 128 | $ret = array(); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | $user = $this->loggableUser($request); |
39 | 39 | |
40 | - if (! $user) { |
|
40 | + if (!$user) { |
|
41 | 41 | return false; |
42 | 42 | } |
43 | 43 | |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | } |
67 | 67 | // set company id as default |
68 | 68 | $main_company = $user->person->company(); |
69 | - if($main_company !== null && !($user->isAdmin())) { |
|
69 | + if ($main_company !== null && !($user->isAdmin())) { |
|
70 | 70 | $c_id = $main_company->id; |
71 | 71 | $db = Connections::Tenant.$c_id; |
72 | 72 | $this->setConnection(Connections::Tenant, $db); |
73 | 73 | } |
74 | 74 | |
75 | - if (! optional($user)->currentPasswordIs($request->input('password'))) { |
|
75 | + if (!optional($user)->currentPasswordIs($request->input('password'))) { |
|
76 | 76 | return; |
77 | 77 | } |
78 | 78 |