@@ -29,7 +29,7 @@ discard block  | 
                                                    ||
| 29 | 29 | * cn = company normal  | 
                                                        
| 30 | 30 | * @var array  | 
                                                        
| 31 | 31 | */  | 
                                                        
| 32 | - protected $custom = ['mode'=>'cn'];  | 
                                                        |
| 32 | + protected $custom = [ 'mode'=>'cn' ];  | 
                                                        |
| 33 | 33 | |
| 34 | 34 | /**  | 
                                                        
| 35 | 35 | * Create a new authentication controller instance.  | 
                                                        
@@ -38,8 +38,8 @@ discard block  | 
                                                    ||
| 38 | 38 | */  | 
                                                        
| 39 | 39 | public function __construct()  | 
                                                        
| 40 | 40 |      { | 
                                                        
| 41 | - config(['auth.model' => \plunner\Company::class]);  | 
                                                        |
| 42 | - config(['jwt.user' => \plunner\Company::class]);  | 
                                                        |
| 41 | + config([ 'auth.model' => \plunner\Company::class ]);  | 
                                                        |
| 42 | + config([ 'jwt.user' => \plunner\Company::class ]);  | 
                                                        |
| 43 | 43 | }  | 
                                                        
| 44 | 44 | |
| 45 | 45 | /**  | 
                                                        
@@ -66,9 +66,9 @@ discard block  | 
                                                    ||
| 66 | 66 | protected function create(array $data)  | 
                                                        
| 67 | 67 |      { | 
                                                        
| 68 | 68 | return Company::create([  | 
                                                        
| 69 | - 'name' => $data['name'],  | 
                                                        |
| 70 | - 'email' => $data['email'],  | 
                                                        |
| 71 | - 'password' => bcrypt($data['password']),  | 
                                                        |
| 69 | + 'name' => $data[ 'name' ],  | 
                                                        |
| 70 | + 'email' => $data[ 'email' ],  | 
                                                        |
| 71 | + 'password' => bcrypt($data[ 'password' ]),  | 
                                                        |
| 72 | 72 | ]);  | 
                                                        
| 73 | 73 | }  | 
                                                        
| 74 | 74 | }  | 
                                                        
@@ -36,7 +36,7 @@ discard block  | 
                                                    ||
| 36 | 36 | * en = employee normal  | 
                                                        
| 37 | 37 | * @var array  | 
                                                        
| 38 | 38 | */  | 
                                                        
| 39 | - protected $custom = ['mode'=>'en'];  | 
                                                        |
| 39 | + protected $custom = [ 'mode'=>'en' ];  | 
                                                        |
| 40 | 40 | |
| 41 | 41 | /**  | 
                                                        
| 42 | 42 | * @var company  | 
                                                        
@@ -50,8 +50,8 @@ discard block  | 
                                                    ||
| 50 | 50 | */  | 
                                                        
| 51 | 51 | public function __construct()  | 
                                                        
| 52 | 52 |      { | 
                                                        
| 53 | - config(['auth.model' => \plunner\Employee::class]);  | 
                                                        |
| 54 | - config(['jwt.user' => \plunner\Employee::class]);  | 
                                                        |
| 53 | + config([ 'auth.model' => \plunner\Employee::class ]);  | 
                                                        |
| 54 | + config([ 'jwt.user' => \plunner\Employee::class ]);  | 
                                                        |
| 55 | 55 | }  | 
                                                        
| 56 | 56 | |
| 57 | 57 | /**  | 
                                                        
@@ -78,15 +78,15 @@ discard block  | 
                                                    ||
| 78 | 78 | protected function create(array $data)  | 
                                                        
| 79 | 79 |      { | 
                                                        
| 80 | 80 | return $this->company->save(new employee([  | 
                                                        
| 81 | - 'name' => $data['name'],  | 
                                                        |
| 82 | - 'email' => $data['email'],  | 
                                                        |
| 83 | - 'password' => bcrypt($data['password']),  | 
                                                        |
| 81 | + 'name' => $data[ 'name' ],  | 
                                                        |
| 82 | + 'email' => $data[ 'email' ],  | 
                                                        |
| 83 | + 'password' => bcrypt($data[ 'password' ]),  | 
                                                        |
| 84 | 84 | ]));  | 
                                                        
| 85 | 85 | }  | 
                                                        
| 86 | 86 | |
| 87 | 87 | public function postRegister(Request $request)  | 
                                                        
| 88 | 88 |      { | 
                                                        
| 89 | - $this->validate($request, ['company' => 'required|exists:companies,name']);  | 
                                                        |
| 89 | + $this->validate($request, [ 'company' => 'required|exists:companies,name' ]);  | 
                                                        |
| 90 | 90 |          $this->company = Company::whereName($request->input('company'))->firstOrFail(); | 
                                                        
| 91 | 91 | return $this->postRegisterOriginal($request);  | 
                                                        
| 92 | 92 | }  | 
                                                        
@@ -94,9 +94,9 @@ discard block  | 
                                                    ||
| 94 | 94 | |
| 95 | 95 | public function postLogin(Request $request)  | 
                                                        
| 96 | 96 |      { | 
                                                        
| 97 | - $this->validate($request, ['company' => 'required|exists:companies,name']);  | 
                                                        |
| 97 | + $this->validate($request, [ 'company' => 'required|exists:companies,name' ]);  | 
                                                        |
| 98 | 98 |          $this->company = Company::whereName($request->input('company'))->firstOrFail(); | 
                                                        
| 99 | - $request->merge(['company_id' => $this->company->id]);  | 
                                                        |
| 99 | + $request->merge([ 'company_id' => $this->company->id ]);  | 
                                                        |
| 100 | 100 | return $this->postLoginOriginal($request);  | 
                                                        
| 101 | 101 | }  | 
                                                        
| 102 | 102 | |
@@ -37,7 +37,7 @@  | 
                                                    ||
| 37 | 37 | */  | 
                                                        
| 38 | 38 | public function map(Router $router)  | 
                                                        
| 39 | 39 |      { | 
                                                        
| 40 | -        $router->group(['namespace' => $this->namespace], function ($router) { | 
                                                        |
| 40 | +        $router->group([ 'namespace' => $this->namespace ], function($router) { | 
                                                        |
| 41 | 41 |              require app_path('Http/routes.php'); | 
                                                        
| 42 | 42 | });  | 
                                                        
| 43 | 43 | }  | 
                                                        
@@ -51,14 +51,14 @@  | 
                                                    ||
| 51 | 51 | *  | 
                                                        
| 52 | 52 | * @var array  | 
                                                        
| 53 | 53 | */  | 
                                                        
| 54 | - protected $fillable = ['name', 'email', 'password'];  | 
                                                        |
| 54 | + protected $fillable = [ 'name', 'email', 'password' ];  | 
                                                        |
| 55 | 55 | |
| 56 | 56 | /**  | 
                                                        
| 57 | 57 | * The attributes excluded from the model's JSON form.  | 
                                                        
| 58 | 58 | *  | 
                                                        
| 59 | 59 | * @var array  | 
                                                        
| 60 | 60 | */  | 
                                                        
| 61 | - protected $hidden = ['password', 'remember_token'];  | 
                                                        |
| 61 | + protected $hidden = [ 'password', 'remember_token' ];  | 
                                                        |
| 62 | 62 | |
| 63 | 63 | public function company()  | 
                                                        
| 64 | 64 |      { | 
                                                        
@@ -20,8 +20,8 @@  | 
                                                    ||
| 20 | 20 | */  | 
                                                        
| 21 | 21 | public function __construct()  | 
                                                        
| 22 | 22 |      { | 
                                                        
| 23 | - config(['auth.model' => \plunner\Company::class]);  | 
                                                        |
| 24 | - config(['jwt.user' => \plunner\Company::class]);  | 
                                                        |
| 23 | + config([ 'auth.model' => \plunner\Company::class ]);  | 
                                                        |
| 24 | + config([ 'jwt.user' => \plunner\Company::class ]);  | 
                                                        |
| 25 | 25 |          $this->middleware('jwt.authandrefresh:mode-cn'); | 
                                                        
| 26 | 26 | }  | 
                                                        
| 27 | 27 | |
@@ -11,7 +11,7 @@  | 
                                                    ||
| 11 | 11 | *  | 
                                                        
| 12 | 12 | * @var array  | 
                                                        
| 13 | 13 | */  | 
                                                        
| 14 | - protected $fillable = ['time_start', 'time_end'];  | 
                                                        |
| 14 | + protected $fillable = [ 'time_start', 'time_end' ];  | 
                                                        |
| 15 | 15 | |
| 16 | 16 | public function employees()  | 
                                                        
| 17 | 17 |      { | 
                                                        
@@ -1,21 +1,21 @@  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | /**  | 
                                                        
| 3 | - * Created by PhpStorm.  | 
                                                        |
| 4 | - * User: Claudio Cardinale <[email protected]>  | 
                                                        |
| 5 | - * Date: 24/11/15  | 
                                                        |
| 6 | - * Time: 21.58  | 
                                                        |
| 7 | - * This program is free software; you can redistribute it and/or  | 
                                                        |
| 8 | - * modify it under the terms of the GNU General Public License  | 
                                                        |
| 9 | - * as published by the Free Software Foundation; either version 2  | 
                                                        |
| 10 | - * of the License, or (at your option) any later version.  | 
                                                        |
| 11 | - * This program is distributed in the hope that it will be useful,  | 
                                                        |
| 12 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of  | 
                                                        |
| 13 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  | 
                                                        |
| 14 | - * GNU General Public License for more details.  | 
                                                        |
| 15 | - * You should have received a copy of the GNU General Public License  | 
                                                        |
| 16 | - * along with this program; if not, write to the Free Software  | 
                                                        |
| 17 | - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  | 
                                                        |
| 18 | - */  | 
                                                        |
| 3 | + * Created by PhpStorm.  | 
                                                        |
| 4 | + * User: Claudio Cardinale <[email protected]>  | 
                                                        |
| 5 | + * Date: 24/11/15  | 
                                                        |
| 6 | + * Time: 21.58  | 
                                                        |
| 7 | + * This program is free software; you can redistribute it and/or  | 
                                                        |
| 8 | + * modify it under the terms of the GNU General Public License  | 
                                                        |
| 9 | + * as published by the Free Software Foundation; either version 2  | 
                                                        |
| 10 | + * of the License, or (at your option) any later version.  | 
                                                        |
| 11 | + * This program is distributed in the hope that it will be useful,  | 
                                                        |
| 12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of  | 
                                                        |
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  | 
                                                        |
| 14 | + * GNU General Public License for more details.  | 
                                                        |
| 15 | + * You should have received a copy of the GNU General Public License  | 
                                                        |
| 16 | + * along with this program; if not, write to the Free Software  | 
                                                        |
| 17 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  | 
                                                        |
| 18 | + */  | 
                                                        |
| 19 | 19 | |
| 20 | 20 | namespace plunner;  | 
                                                        
| 21 | 21 | |
@@ -46,7 +46,7 @@  | 
                                                    ||
| 46 | 46 | *  | 
                                                        
| 47 | 47 | * @var string  | 
                                                        
| 48 | 48 | */  | 
                                                        
| 49 | - //protected $table = 'employees';  | 
                                                        |
| 49 | + //protected $table = 'employees';  | 
                                                        |
| 50 | 50 | |
| 51 | 51 | /**  | 
                                                        
| 52 | 52 | * The attributes that are mass assignable.  | 
                                                        
@@ -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', 'pivot'];  | 
                                                        |
| 67 | + protected $hidden = [ 'password', 'remember_token', 'pivot' ];  | 
                                                        |
| 68 | 68 | |
| 69 | 69 | /**  | 
                                                        
| 70 | 70 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo  | 
                                                        
@@ -109,16 +109,16 @@ discard block  | 
                                                    ||
| 109 | 109 | public function getEmailForPasswordReset()  | 
                                                        
| 110 | 110 |      { | 
                                                        
| 111 | 111 | list(, $caller) = debug_backtrace(false);  | 
                                                        
| 112 | - if(isset($caller['class']))  | 
                                                        |
| 113 | -            $caller = explode('\\', $caller['class']); | 
                                                        |
| 112 | + if (isset($caller[ 'class' ]))  | 
                                                        |
| 113 | +            $caller = explode('\\', $caller[ 'class' ]); | 
                                                        |
| 114 | 114 | else  | 
                                                        
| 115 | 115 | $caller = '';  | 
                                                        
| 116 | 116 | |
| 117 | 117 | //check if this function is called by email sender  | 
                                                        
| 118 | -        if ((count($caller) && $caller[count($caller) - 1] == 'PasswordBroker') || (defined('HHVM_VERSION') && $caller == '')) | 
                                                        |
| 118 | +        if ((count($caller) && $caller[ count($caller) - 1 ] == 'PasswordBroker') || (defined('HHVM_VERSION') && $caller == '')) | 
                                                        |
| 119 | 119 | return $this->email;  | 
                                                        
| 120 | 120 | //return unique identify for token repository  | 
                                                        
| 121 | - return $this->email . $this->company->id;  | 
                                                        |
| 121 | + return $this->email.$this->company->id;  | 
                                                        |
| 122 | 122 | }  | 
                                                        
| 123 | 123 | |
| 124 | 124 | /**  | 
                                                        
@@ -128,7 +128,7 @@ discard block  | 
                                                    ||
| 128 | 128 | public function belongsToGroup(Group $group)  | 
                                                        
| 129 | 129 |      { | 
                                                        
| 130 | 130 |          $group = $this->groups()->where('id', $group->id)->first(); | 
                                                        
| 131 | - if(is_object($group) && $group->exists)  | 
                                                        |
| 131 | + if (is_object($group) && $group->exists)  | 
                                                        |
| 132 | 132 | return true;  | 
                                                        
| 133 | 133 | return false;  | 
                                                        
| 134 | 134 | }  | 
                                                        
@@ -21,8 +21,8 @@ discard block  | 
                                                    ||
| 21 | 21 | */  | 
                                                        
| 22 | 22 | public function __construct()  | 
                                                        
| 23 | 23 |      { | 
                                                        
| 24 | - config(['auth.model' => \plunner\Company::class]);  | 
                                                        |
| 25 | - config(['jwt.user' => \plunner\Company::class]);  | 
                                                        |
| 24 | + config([ 'auth.model' => \plunner\Company::class ]);  | 
                                                        |
| 25 | + config([ 'jwt.user' => \plunner\Company::class ]);  | 
                                                        |
| 26 | 26 |          $this->middleware('jwt.authandrefresh:mode-cn'); | 
                                                        
| 27 | 27 | }  | 
                                                        
| 28 | 28 | |
@@ -53,7 +53,7 @@ discard block  | 
                                                    ||
| 53 | 53 | //  | 
                                                        
| 54 | 54 | $group = Group::findOrFail($groupId);  | 
                                                        
| 55 | 55 | $this->authorize($group);  | 
                                                        
| 56 | - $id = $request->all()['id'];  | 
                                                        |
| 56 | + $id = $request->all()[ 'id' ];  | 
                                                        |
| 57 | 57 | $group->employees()->attach($id);  | 
                                                        
| 58 | 58 | return $group->employees;  | 
                                                        
| 59 | 59 | }  | 
                                                        
@@ -71,8 +71,8 @@ discard block  | 
                                                    ||
| 71 | 71 | $employee = Employee::findOrFail($employeeId);  | 
                                                        
| 72 | 72 | $this->authorize($employee);  | 
                                                        
| 73 | 73 | $group = Group::findOrFail($groupId);  | 
                                                        
| 74 | - if(!$employee->belongsToGroup($group))  | 
                                                        |
| 75 | - return Response::json(['error' => 'employId <> groupId'],404);  | 
                                                        |
| 74 | + if (!$employee->belongsToGroup($group))  | 
                                                        |
| 75 | + return Response::json([ 'error' => 'employId <> groupId' ], 404);  | 
                                                        |
| 76 | 76 | $employee->groups()->detach($groupId);  | 
                                                        
| 77 | 77 | return $group->employees;  | 
                                                        
| 78 | 78 | }  |