@@ -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 | /** |
@@ -114,8 +114,9 @@ |
||
| 114 | 114 | public function belongsToGroup(Group $group) |
| 115 | 115 | { |
| 116 | 116 | $group = $this->groups()->where('id', $group->id)->first(); |
| 117 | - if(is_object($group) && $group->exists) |
|
| 118 | - return true; |
|
| 117 | + if(is_object($group) && $group->exists) { |
|
| 118 | + return true; |
|
| 119 | + } |
|
| 119 | 120 | return false; |
| 120 | 121 | } |
| 121 | 122 | |
@@ -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 | } |
@@ -53,8 +53,9 @@ discard block |
||
| 53 | 53 | // |
| 54 | 54 | $company = \Auth::user(); |
| 55 | 55 | $input = $request->all(); |
| 56 | - if(isset($input['password'])) |
|
| 57 | - $input['password'] = bcrypt($input['password']); |
|
| 56 | + if(isset($input['password'])) { |
|
| 57 | + $input['password'] = bcrypt($input['password']); |
|
| 58 | + } |
|
| 58 | 59 | $employee = $company->employees()->create($input); |
| 59 | 60 | return $employee; |
| 60 | 61 | } |
@@ -86,8 +87,9 @@ discard block |
||
| 86 | 87 | $employee = Employee::findOrFail($id); |
| 87 | 88 | $this->authorize($employee); |
| 88 | 89 | $input = $request->all(); |
| 89 | - if(isset($input['password'])) |
|
| 90 | - $input['password'] = bcrypt($input['password']); |
|
| 90 | + if(isset($input['password'])) { |
|
| 91 | + $input['password'] = bcrypt($input['password']); |
|
| 92 | + } |
|
| 91 | 93 | $employee->update($input); |
| 92 | 94 | return $employee; |
| 93 | 95 | } |