@@ -9,7 +9,7 @@ |
||
| 9 | 9 | { |
| 10 | 10 | public static function set($user, $tenant) |
| 11 | 11 | { |
| 12 | - if (! $user->belongsToAdminGroup() || $tenant) { |
|
| 12 | + if (!$user->belongsToAdminGroup() || $tenant) { |
|
| 13 | 13 | self::connection(Connections::Tenant); |
| 14 | 14 | } else { |
| 15 | 15 | self::connection('mysql'); |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function handle($request, Closure $next) |
| 19 | 19 | { |
| 20 | - if (! $request->user()) { |
|
| 20 | + if (!$request->user()) { |
|
| 21 | 21 | return $next($request); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -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) |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | protected function create(array $data) |
| 43 | 43 | { |
| 44 | - try{ |
|
| 44 | + try { |
|
| 45 | 45 | DB::beginTransaction(); |
| 46 | 46 | // create person |
| 47 | 47 | $person = new Person(); |
@@ -49,15 +49,15 @@ discard block |
||
| 49 | 49 | $person->save(); |
| 50 | 50 | |
| 51 | 51 | // get user_group_id |
| 52 | - $user_group = UserGroup::where('name','User')->first(); |
|
| 53 | - if($user_group == null) { |
|
| 52 | + $user_group = UserGroup::where('name', 'User')->first(); |
|
| 53 | + if ($user_group == null) { |
|
| 54 | 54 | // create user_group |
| 55 | 55 | $user_group = UserGroup::create(['name'=>'User', 'description'=>'This is user group']); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // get role_id |
| 59 | 59 | $role = Role::where('name', 'supervisor')->first(); |
| 60 | - if($role == null) { |
|
| 60 | + if ($role == null) { |
|
| 61 | 61 | $role = Role::create(['menu_id'=>1, 'name'=>'supervisor', 'display_name'=>'User', 'description'=>'This is user']); |
| 62 | 62 | } |
| 63 | 63 | $user = User::create([ |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | Migrate::dispatch($company); |
| 92 | 92 | |
| 93 | 93 | return $user; |
| 94 | - }catch(\Exception $e){ |
|
| 94 | + } catch (\Exception $e) { |
|
| 95 | 95 | DB::rollBack(); |
| 96 | 96 | throw $e; |
| 97 | 97 | } |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | Migrate::dispatch($company); |
| 92 | 92 | |
| 93 | 93 | return $user; |
| 94 | - }catch(\Exception $e){ |
|
| 94 | + } catch(\Exception $e){ |
|
| 95 | 95 | DB::rollBack(); |
| 96 | 96 | throw $e; |
| 97 | 97 | } |
@@ -79,18 +79,18 @@ |
||
| 79 | 79 | 'name' => $data['name'], |
| 80 | 80 | 'email' => $data['email'], |
| 81 | 81 | 'is_active' => 1, |
| 82 | - 'is_tenant' => 1, |
|
| 83 | - 'status' => 1 |
|
| 82 | + 'is_tenant' => 1, |
|
| 83 | + 'status' => 1 |
|
| 84 | 84 | ]); |
| 85 | 85 | |
| 86 | 86 | // $company->attachPerson($person->id, 'Owner'); |
| 87 | 87 | |
| 88 | - $person->companies()->attach($company->id, ['person_id' => $person->id, 'is_main' => 1, 'is_mandatary' => 1, 'company_id' => $company->id]); |
|
| 88 | + $person->companies()->attach($company->id, ['person_id' => $person->id, 'is_main' => 1, 'is_mandatary' => 1, 'company_id' => $company->id]); |
|
| 89 | 89 | |
| 90 | - // Dispatch Tenancy Jobs |
|
| 90 | + // Dispatch Tenancy Jobs |
|
| 91 | 91 | |
| 92 | - CreateDatabase::dispatch($company); |
|
| 93 | - Migrate::dispatch($company); |
|
| 92 | + CreateDatabase::dispatch($company); |
|
| 93 | + Migrate::dispatch($company); |
|
| 94 | 94 | |
| 95 | 95 | return $user; |
| 96 | 96 | }catch(\Exception $e){ |