@@ -3,8 +3,8 @@ |
||
3 | 3 | namespace plunner\Http\Controllers\Employees\Auth; |
4 | 4 | |
5 | 5 | use Illuminate\Http\Request; |
6 | -use plunner\Http\Controllers\Controller; |
|
7 | 6 | use Tymon\JWTAuth\Support\auth\ResetsPasswords; |
7 | +use plunner\Http\Controllers\Controller; |
|
8 | 8 | use \plunner\Company; |
9 | 9 | use \plunner\Employee; |
10 | 10 |
@@ -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 | } |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Http\Request; |
6 | 6 | |
7 | -use plunner\Http\Requests; |
|
8 | 7 | use plunner\Http\Controllers\Controller; |
9 | 8 | |
10 | 9 | class GroupsController extends Controller |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * |
12 | 12 | * @var array |
13 | 13 | */ |
14 | - protected $fillable = ['name']; |
|
14 | + protected $fillable = [ 'name' ]; |
|
15 | 15 | |
16 | 16 | public function employees() |
17 | 17 | { |
@@ -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 |
@@ -4,9 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Http\Request; |
6 | 6 | |
7 | -use plunner\Group; |
|
8 | -use plunner\Employee; |
|
9 | -use plunner\Http\Requests; |
|
10 | 7 | use plunner\Http\Controllers\Controller; |
11 | 8 | |
12 | 9 | class GroupsController extends Controller |
@@ -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']; |
|
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 |
@@ -51,8 +51,9 @@ |
||
51 | 51 | |
52 | 52 | public function getPlannerNameAttribute() |
53 | 53 | { |
54 | - if(is_object($this->planner) && $this->planner->exists) |
|
55 | - return $this->planner->name; |
|
54 | + if(is_object($this->planner) && $this->planner->exists) { |
|
55 | + return $this->planner->name; |
|
56 | + } |
|
56 | 57 | } |
57 | 58 | |
58 | 59 | /** |
@@ -37,21 +37,21 @@ |
||
37 | 37 | * |
38 | 38 | * @var array |
39 | 39 | */ |
40 | - protected $fillable = ['name', 'description', 'planner_id']; |
|
40 | + protected $fillable = [ 'name', 'description', 'planner_id' ]; |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * @var array |
44 | 44 | */ |
45 | - protected $hidden = ['planner']; |
|
45 | + protected $hidden = [ 'planner' ]; |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * @var array |
49 | 49 | */ |
50 | - protected $appends = ['planner_name']; |
|
50 | + protected $appends = [ 'planner_name' ]; |
|
51 | 51 | |
52 | 52 | public function getPlannerNameAttribute() |
53 | 53 | { |
54 | - if(is_object($this->planner) && $this->planner->exists) |
|
54 | + if (is_object($this->planner) && $this->planner->exists) |
|
55 | 55 | return $this->planner->name; |
56 | 56 | } |
57 | 57 |
@@ -3,8 +3,8 @@ |
||
3 | 3 | namespace plunner\Http\Controllers\Companies\Groups; |
4 | 4 | |
5 | 5 | use Illuminate\Support\Facades\Response; |
6 | -use plunner\Group; |
|
7 | 6 | use plunner\Employee; |
7 | +use plunner\Group; |
|
8 | 8 | use plunner\Http\Controllers\Controller; |
9 | 9 | use plunner\Http\Requests\Companies\Groups\EmployeeRequest; |
10 | 10 |
@@ -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 | } |
@@ -71,8 +71,9 @@ |
||
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 | 77 | $employee->groups()->detach($groupId); |
77 | 78 | return $group->employees; |
78 | 79 | } |