@@ -57,14 +57,14 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @var array |
| 59 | 59 | */ |
| 60 | - protected $fillable = ['name', 'email', 'password']; |
|
| 60 | + protected $fillable = [ 'name', 'email', 'password' ]; |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * The attributes excluded from the model's JSON form. |
| 64 | 64 | * |
| 65 | 65 | * @var array |
| 66 | 66 | */ |
| 67 | - protected $hidden = ['password', 'remember_token']; |
|
| 67 | + protected $hidden = [ 'password', 'remember_token' ]; |
|
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | 70 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
@@ -109,13 +109,13 @@ discard block |
||
| 109 | 109 | public function getEmailForPasswordReset() |
| 110 | 110 | { |
| 111 | 111 | list(, $caller) = debug_backtrace(false); |
| 112 | - $caller = explode('\\', $caller['class']); |
|
| 112 | + $caller = explode('\\', $caller[ 'class' ]); |
|
| 113 | 113 | |
| 114 | 114 | //check if this function is called by email sender |
| 115 | - if ($caller[count($caller) - 1] == 'PasswordBroker') |
|
| 115 | + if ($caller[ count($caller) - 1 ] == 'PasswordBroker') |
|
| 116 | 116 | return $this->email; |
| 117 | 117 | //return unique identify for token repository |
| 118 | - return $this->email . $this->company->id; |
|
| 118 | + return $this->email.$this->company->id; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | public function belongsToGroup(Group $group) |
| 126 | 126 | { |
| 127 | 127 | $group = $this->groups()->where('id', $group->id)->first(); |
| 128 | - if(is_object($group) && $group->exists) |
|
| 128 | + if (is_object($group) && $group->exists) |
|
| 129 | 129 | return true; |
| 130 | 130 | return false; |
| 131 | 131 | } |
@@ -112,8 +112,9 @@ discard block |
||
| 112 | 112 | $caller = explode('\\', $caller['class']); |
| 113 | 113 | |
| 114 | 114 | //check if this function is called by email sender |
| 115 | - if ($caller[count($caller) - 1] == 'PasswordBroker') |
|
| 116 | - return $this->email; |
|
| 115 | + if ($caller[count($caller) - 1] == 'PasswordBroker') { |
|
| 116 | + return $this->email; |
|
| 117 | + } |
|
| 117 | 118 | //return unique identify for token repository |
| 118 | 119 | return $this->email . $this->company->id; |
| 119 | 120 | } |
@@ -125,8 +126,9 @@ discard block |
||
| 125 | 126 | public function belongsToGroup(Group $group) |
| 126 | 127 | { |
| 127 | 128 | $group = $this->groups()->where('id', $group->id)->first(); |
| 128 | - if(is_object($group) && $group->exists) |
|
| 129 | - return true; |
|
| 129 | + if(is_object($group) && $group->exists) { |
|
| 130 | + return true; |
|
| 131 | + } |
|
| 130 | 132 | return false; |
| 131 | 133 | } |
| 132 | 134 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * cn = company normal |
| 32 | 32 | * @var array |
| 33 | 33 | */ |
| 34 | - protected $custom = ['mode'=>'cn']; |
|
| 34 | + protected $custom = [ 'mode'=>'cn' ]; |
|
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function __construct() |
| 43 | 43 | { |
| 44 | - config(['auth.model' => \plunner\Company::class]); |
|
| 45 | - config(['jwt.user' => \plunner\Company::class]); |
|
| 46 | - config(['auth.password.table' => 'password_resets_companies', 'auth.password.email' => 'emails.companies.password']); |
|
| 44 | + config([ 'auth.model' => \plunner\Company::class ]); |
|
| 45 | + config([ 'jwt.user' => \plunner\Company::class ]); |
|
| 46 | + config([ 'auth.password.table' => 'password_resets_companies', 'auth.password.email' => 'emails.companies.password' ]); |
|
| 47 | 47 | } |
| 48 | 48 | } |
@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | * en = employee normal |
| 39 | 39 | * @var array |
| 40 | 40 | */ |
| 41 | - protected $custom = ['mode'=>'en']; |
|
| 41 | + protected $custom = [ 'mode'=>'en' ]; |
|
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * @var array |
| 45 | 45 | */ |
| 46 | - protected $username = ['email', 'company_id']; |
|
| 46 | + protected $username = [ 'email', 'company_id' ]; |
|
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * @var company |
@@ -57,24 +57,24 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function __construct() |
| 59 | 59 | { |
| 60 | - config(['auth.model' => \plunner\Employee::class]); |
|
| 61 | - config(['jwt.user' => \plunner\Employee::class]); |
|
| 62 | - config(['auth.password.table' => 'password_resets_employees', 'auth.password.email' => 'emails.employees.password']); |
|
| 60 | + config([ 'auth.model' => \plunner\Employee::class ]); |
|
| 61 | + config([ 'jwt.user' => \plunner\Employee::class ]); |
|
| 62 | + config([ 'auth.password.table' => 'password_resets_employees', 'auth.password.email' => 'emails.employees.password' ]); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | public function postEmail(Request $request) |
| 66 | 66 | { |
| 67 | - $this->validate($request, ['company' => 'required|exists:companies,name']); |
|
| 67 | + $this->validate($request, [ 'company' => 'required|exists:companies,name' ]); |
|
| 68 | 68 | $this->company = Company::whereName($request->input('company'))->firstOrFail(); |
| 69 | - $request->merge(['company_id' => $this->company->id]); |
|
| 69 | + $request->merge([ 'company_id' => $this->company->id ]); |
|
| 70 | 70 | return $this->postEmailOriginal($request); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | public function postReset(Request $request) |
| 74 | 74 | { |
| 75 | - $this->validate($request, ['company' => 'required|exists:companies,name']); |
|
| 75 | + $this->validate($request, [ 'company' => 'required|exists:companies,name' ]); |
|
| 76 | 76 | $this->company = Company::whereName($request->input('company'))->firstOrFail(); |
| 77 | - $request->merge(['company_id' => $this->company->id]); |
|
| 77 | + $request->merge([ 'company_id' => $this->company->id ]); |
|
| 78 | 78 | return $this->postResetOriginal($request); |
| 79 | 79 | } |
| 80 | 80 | |