@@ -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 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | protected function create(array $data) |
| 40 | 40 | { |
| 41 | - try{ |
|
| 41 | + try { |
|
| 42 | 42 | DB::beginTransaction(); |
| 43 | 43 | // create person |
| 44 | 44 | $person = new Person(); |
@@ -46,15 +46,15 @@ discard block |
||
| 46 | 46 | $person->save(); |
| 47 | 47 | |
| 48 | 48 | // get user_group_id |
| 49 | - $user_group = UserGroup::where('name','User')->first(); |
|
| 50 | - if($user_group == null) { |
|
| 49 | + $user_group = UserGroup::where('name', 'User')->first(); |
|
| 50 | + if ($user_group == null) { |
|
| 51 | 51 | // create user_group |
| 52 | 52 | $user_group = UserGroup::create(['name'=>'User', 'description'=>'This is user group']); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // get role_id |
| 56 | 56 | $role = Role::where('name', 'supervisor')->first(); |
| 57 | - if($role == null) { |
|
| 57 | + if ($role == null) { |
|
| 58 | 58 | $role = Role::create(['menu_id'=>1, 'name'=>'supervisor', 'display_name'=>'User', 'description'=>'This is user']); |
| 59 | 59 | } |
| 60 | 60 | $user = User::create([ |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | // send verification email; |
| 73 | 73 | |
| 74 | 74 | return $user; |
| 75 | - }catch(\Exception $e){ |
|
| 75 | + } catch (\Exception $e) { |
|
| 76 | 76 | DB::rollBack(); |
| 77 | 77 | throw $e; |
| 78 | 78 | } |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | // send verification email; |
| 73 | 73 | |
| 74 | 74 | return $user; |
| 75 | - }catch(\Exception $e){ |
|
| 75 | + } catch(\Exception $e){ |
|
| 76 | 76 | DB::rollBack(); |
| 77 | 77 | throw $e; |
| 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) |