@@ -12,5 +12,5 @@ |
||
12 | 12 | use Comments, Discussions, Replies; |
13 | 13 | protected $hidden = ['password', 'remember_token', 'password_updated_at']; |
14 | 14 | |
15 | - protected $fillable = ['person_id', 'group_id', 'role_id', 'email', 'is_active','email_verified_at','password']; |
|
15 | + protected $fillable = ['person_id', 'group_id', 'role_id', 'email', 'is_active', 'email_verified_at', 'password']; |
|
16 | 16 | } |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | public function verify_user(Request $request) { |
39 | 39 | $data = $request->all(); |
40 | 40 | $this->validator($data)->validate(); |
41 | - try{ |
|
41 | + try { |
|
42 | 42 | $token = $request->get('token'); |
43 | 43 | $activation = Activation::where('token', $token)->first(); |
44 | - if($activation === null) { |
|
44 | + if ($activation === null) { |
|
45 | 45 | return response()->json( |
46 | 46 | [ |
47 | 47 | 'error' => |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | $user_id = $activation->user_id; |
56 | 56 | $user = User::find($user_id); |
57 | - if($user === null) { |
|
57 | + if ($user === null) { |
|
58 | 58 | return response()->json( |
59 | 59 | [ |
60 | 60 | 'error' => |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | return response()->json([ |
73 | 73 | 'csrfToken' => csrf_token(), |
74 | 74 | ]); |
75 | - }catch(\Exception $e) { |
|
75 | + } catch (\Exception $e) { |
|
76 | 76 | throw $e; |
77 | 77 | } |
78 | 78 | } |
@@ -72,7 +72,7 @@ |
||
72 | 72 | return response()->json([ |
73 | 73 | 'csrfToken' => csrf_token(), |
74 | 74 | ]); |
75 | - }catch(\Exception $e) { |
|
75 | + } catch(\Exception $e) { |
|
76 | 76 | throw $e; |
77 | 77 | } |
78 | 78 | } |
@@ -75,13 +75,13 @@ |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * Creates a token and send email.- api |
|
80 | - * |
|
81 | - * @param \App\Models\User $user |
|
82 | - * |
|
83 | - * @return bool or void |
|
84 | - */ |
|
78 | + /** |
|
79 | + * Creates a token and send email.- api |
|
80 | + * |
|
81 | + * @param \App\Models\User $user |
|
82 | + * |
|
83 | + * @return bool or void |
|
84 | + */ |
|
85 | 85 | public function createTokenAndSendEmailApi(User $user) |
86 | 86 | { |
87 | 87 | $activations = Activation::where('user_id', $user->id) |
@@ -31,12 +31,12 @@ |
||
31 | 31 | * |
32 | 32 | * @return void |
33 | 33 | */ |
34 | - public function __construct(Company $tenant, $name='', $email='', $password='') |
|
34 | + public function __construct(Company $tenant, $name = '', $email = '', $password = '') |
|
35 | 35 | { |
36 | 36 | // |
37 | 37 | $this->tenant = $tenant; |
38 | 38 | $this->name = $name; |
39 | - $this->email= $email; |
|
39 | + $this->email = $email; |
|
40 | 40 | $this->password = $password; |
41 | 41 | // $this->queue = 'sync'; |
42 | 42 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | { |
10 | 10 | public static function set($user, $tenant) |
11 | 11 | { |
12 | - if ( $tenant) { |
|
12 | + if ($tenant) { |
|
13 | 13 | self::connection(Connections::Tenant); |
14 | 14 | } else { |
15 | 15 | self::connection('mysql'); |
@@ -23,7 +23,7 @@ |
||
23 | 23 | \DB::purge('mysql'); |
24 | 24 | \DB::reconnect('mysql'); |
25 | 25 | |
26 | - if (! $request->user()) { |
|
26 | + if (!$request->user()) { |
|
27 | 27 | return $next($request); |
28 | 28 | } |
29 | 29 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | protected function create(array $data) |
46 | 46 | { |
47 | - try{ |
|
47 | + try { |
|
48 | 48 | DB::beginTransaction(); |
49 | 49 | // create person |
50 | 50 | $person = new Person(); |
@@ -53,15 +53,15 @@ discard block |
||
53 | 53 | $person->save(); |
54 | 54 | |
55 | 55 | // get user_group_id |
56 | - $user_group = UserGroup::where('name','Administrators')->first(); |
|
57 | - if($user_group == null) { |
|
56 | + $user_group = UserGroup::where('name', 'Administrators')->first(); |
|
57 | + if ($user_group == null) { |
|
58 | 58 | // create user_group |
59 | 59 | $user_group = UserGroup::create(['name'=>'Administrators', 'description'=>'Administrator users group']); |
60 | 60 | } |
61 | 61 | |
62 | 62 | // get role_id |
63 | 63 | $role = Role::where('name', 'supervisor')->first(); |
64 | - if($role == null) { |
|
64 | + if ($role == null) { |
|
65 | 65 | $role = Role::create(['menu_id'=>1, 'name'=>'supervisor', 'display_name'=>'Supervisor', 'description'=>'Supervisor role.']); |
66 | 66 | } |
67 | 67 | $user = User::create([ |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | |
98 | 98 | return $user; |
99 | - }catch(\Exception $e){ |
|
99 | + } catch (\Exception $e) { |
|
100 | 100 | DB::rollBack(); |
101 | 101 | throw $e; |
102 | 102 | } |
@@ -96,7 +96,7 @@ |
||
96 | 96 | |
97 | 97 | |
98 | 98 | return $user; |
99 | - }catch(\Exception $e){ |
|
99 | + } catch(\Exception $e){ |
|
100 | 100 | DB::rollBack(); |
101 | 101 | throw $e; |
102 | 102 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | { |
56 | 56 | $user = $this->loggableUser($request); |
57 | 57 | |
58 | - if (! $user) { |
|
58 | + if (!$user) { |
|
59 | 59 | return false; |
60 | 60 | } |
61 | 61 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $user = User::whereEmail($request->input('email'))->first(); |
80 | 80 | $company = $user->company(); |
81 | 81 | $tanent = false; |
82 | - if($company) { |
|
82 | + if ($company) { |
|
83 | 83 | $tanent = true; |
84 | 84 | } |
85 | 85 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | // Tenant::set($company); |
93 | 93 | $value = Connections::Tenant.$company->id; |
94 | 94 | |
95 | - }else{ |
|
95 | + } else { |
|
96 | 96 | $value = ''; |
97 | 97 | |
98 | 98 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | \Session::put('db', $value); |
107 | 107 | |
108 | - if (! optional($user)->currentPasswordIs($request->input('password'))) { |
|
108 | + if (!optional($user)->currentPasswordIs($request->input('password'))) { |
|
109 | 109 | return; |
110 | 110 | } |
111 | 111 |
@@ -92,7 +92,7 @@ |
||
92 | 92 | // Tenant::set($company); |
93 | 93 | $value = Connections::Tenant.$company->id; |
94 | 94 | |
95 | - }else{ |
|
95 | + } else{ |
|
96 | 96 | $value = ''; |
97 | 97 | |
98 | 98 | } |