@@ -31,7 +31,7 @@ |
||
| 31 | 31 | public function rules() |
| 32 | 32 | { |
| 33 | 33 | return [ |
| 34 | - 'id' => 'required|array|exists:employees,id,company_id,' . $this->user()->id, |
|
| 34 | + 'id' => 'required|array|exists:employees,id,company_id,'.$this->user()->id, |
|
| 35 | 35 | ]; |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -31,9 +31,9 @@ |
||
| 31 | 31 | public function rules() |
| 32 | 32 | { |
| 33 | 33 | return [ |
| 34 | - 'name' => 'required|max:255|unique:groups,name,' . $this->route('groups') . ',id,company_id,' . $this->user()->id, |
|
| 34 | + 'name' => 'required|max:255|unique:groups,name,'.$this->route('groups').',id,company_id,'.$this->user()->id, |
|
| 35 | 35 | 'description' => 'sometimes|required|max:255', |
| 36 | - 'planner_id' => 'required|exists:employees,id,company_id,' . $this->user()->id, |
|
| 36 | + 'planner_id' => 'required|exists:employees,id,company_id,'.$this->user()->id, |
|
| 37 | 37 | ]; |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | public function handle(ErrorEvent $event) |
| 27 | 27 | { |
| 28 | 28 | // |
| 29 | - \Log::info('problems during caldav (calendar id = ' . $event->getCalendar()->calendar_id . ') sync: ' . $event->getError()); |
|
| 29 | + \Log::info('problems during caldav (calendar id = '.$event->getCalendar()->calendar_id.') sync: '.$event->getError()); |
|
| 30 | 30 | $calendar = $event->getCalendar(); |
| 31 | 31 | //$calendar = $event->getCalendar()->fresh(); |
| 32 | 32 | $calendar->sync_errors = $event->getError(); |
@@ -31,8 +31,9 @@ |
||
| 31 | 31 | self::sendCompanyEmail($company->email); |
| 32 | 32 | //send emails to employees |
| 33 | 33 | $employees = $company->employees()->with('meetings')->get(); |
| 34 | - foreach ($employees as $employee) |
|
| 35 | - self::sendEmployeeEmail($employee->email, $employee->meetings); |
|
| 34 | + foreach ($employees as $employee) { |
|
| 35 | + self::sendEmployeeEmail($employee->email, $employee->meetings); |
|
| 36 | + } |
|
| 36 | 37 | } |
| 37 | 38 | |
| 38 | 39 | /** |
@@ -49,6 +49,10 @@ discard block |
||
| 49 | 49 | }); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | + /** |
|
| 53 | + * @param string $title |
|
| 54 | + * @param string $message |
|
| 55 | + */ |
|
| 52 | 56 | static private function sendPushs($title, $message, $additionalData = '') |
| 53 | 57 | { |
| 54 | 58 | $clients = explode(';', config('app.gcm_clients')); |
@@ -58,6 +62,9 @@ discard block |
||
| 58 | 62 | //self::sendPushNotification($clients, $message, $title); |
| 59 | 63 | } |
| 60 | 64 | |
| 65 | + /** |
|
| 66 | + * @param string $additionalData |
|
| 67 | + */ |
|
| 61 | 68 | static private function sendPushNotification($to, $message, $title, $additionalData) |
| 62 | 69 | { |
| 63 | 70 | // replace API |
@@ -25,15 +25,15 @@ discard block |
||
| 25 | 25 | public function handle(OkEvent $event) |
| 26 | 26 | { |
| 27 | 27 | // |
| 28 | - \Log::info('Meeting correctly optimised (company id = ' . $event->getCompany()->id . ')'); |
|
| 28 | + \Log::info('Meeting correctly optimised (company id = '.$event->getCompany()->id.')'); |
|
| 29 | 29 | $company = $event->getCompany()->fresh(); |
| 30 | 30 | //send email to company |
| 31 | 31 | self::sendCompanyEmail($company->email); |
| 32 | 32 | //send emails to employees |
| 33 | - $employees = $company->employees()->with(['meetings'=>function($query){ |
|
| 33 | + $employees = $company->employees()->with([ 'meetings'=>function($query) { |
|
| 34 | 34 | $query->where('start_time', '>=', new \DateTime()); |
| 35 | - }])->get(); |
|
| 36 | - self::sendPushs('New meeting scheduled', $employees->get(0)->meetings->get(0)['title'] . ' - ' . $employees->get(0)->meetings->get(0)['start_time'], $employees->get(0)->meetings->get(0)['id']); |
|
| 35 | + } ])->get(); |
|
| 36 | + self::sendPushs('New meeting scheduled', $employees->get(0)->meetings->get(0)[ 'title' ].' - '.$employees->get(0)->meetings->get(0)[ 'start_time' ], $employees->get(0)->meetings->get(0)[ 'id' ]); |
|
| 37 | 37 | foreach ($employees as $employee) |
| 38 | 38 | self::sendEmployeeEmail($employee->email, $employee->meetings); |
| 39 | 39 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | static private function sendCompanyEmail($email) |
| 45 | 45 | { |
| 46 | - \Mail::queue('emails.optimise.ok.company', [], function ($message) use ($email) { |
|
| 46 | + \Mail::queue('emails.optimise.ok.company', [ ], function($message) use ($email) { |
|
| 47 | 47 | $message->from(config('mail.from.address'), config('mail.from.name')); |
| 48 | 48 | $message->to($email)->subject('Meetings optimised'); |
| 49 | 49 | }); |
@@ -63,8 +63,7 @@ discard block |
||
| 63 | 63 | // replace API |
| 64 | 64 | //\Log::info('GCM registration id: ' . $to); |
| 65 | 65 | $registrationIds = array($to); |
| 66 | - $msg = array |
|
| 67 | - ( |
|
| 66 | + $msg = array( |
|
| 68 | 67 | 'message' => $message, |
| 69 | 68 | 'title' => $title, |
| 70 | 69 | 'vibrate' => 1, |
@@ -73,14 +72,12 @@ discard block |
||
| 73 | 72 | |
| 74 | 73 | // you can also add images, additionalData |
| 75 | 74 | ); |
| 76 | - $fields = array |
|
| 77 | - ( |
|
| 75 | + $fields = array( |
|
| 78 | 76 | 'registration_ids' => $registrationIds, |
| 79 | 77 | 'data' => $msg |
| 80 | 78 | ); |
| 81 | - $headers = array |
|
| 82 | - ( |
|
| 83 | - 'Authorization: key=' . config('app.gcm_key'), |
|
| 79 | + $headers = array( |
|
| 80 | + 'Authorization: key='.config('app.gcm_key'), |
|
| 84 | 81 | 'Content-Type: application/json' |
| 85 | 82 | ); |
| 86 | 83 | $ch = curl_init(); |
@@ -93,7 +90,7 @@ discard block |
||
| 93 | 90 | $result = curl_exec($ch); |
| 94 | 91 | curl_close($ch); |
| 95 | 92 | //echo $result; |
| 96 | - \Log::info('GCM results: ' . $result); |
|
| 93 | + \Log::info('GCM results: '.$result); |
|
| 97 | 94 | } |
| 98 | 95 | |
| 99 | 96 | /** |
@@ -102,7 +99,7 @@ discard block |
||
| 102 | 99 | */ |
| 103 | 100 | static private function sendEmployeeEmail($email, $meetings) |
| 104 | 101 | { |
| 105 | - \Mail::queue('emails.optimise.ok.employee', ['meetings' => $meetings], function ($message) use ($email) { |
|
| 102 | + \Mail::queue('emails.optimise.ok.employee', [ 'meetings' => $meetings ], function($message) use ($email) { |
|
| 106 | 103 | $message->from(config('mail.from.address'), config('mail.from.name')); |
| 107 | 104 | $message->to($email)->subject('Meetings of next week'); |
| 108 | 105 | }); |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | */ |
| 57 | 57 | public function verifyEmployee(Employee $employee) |
| 58 | 58 | { |
| 59 | - $group = $this->groupsManaged()->whereHas('employees', function ($query) use ($employee) { |
|
| 59 | + $group = $this->groupsManaged()->whereHas('employees', function($query) use ($employee) { |
|
| 60 | 60 | $query->where('employees.id', $employee->id); |
| 61 | 61 | })->first(); |
| 62 | 62 | |
@@ -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 |
@@ -32,9 +32,11 @@ discard block |
||
| 32 | 32 | $group = Group::findOrFail($groupId); |
| 33 | 33 | $this->authorize($group); |
| 34 | 34 | $meetings = $group->meetings(); |
| 35 | - if ($request->query('current')) |
|
| 36 | - $meetings->where(function ($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 37 | - $query->where('start_time', '=', NULL);//to be planned |
|
| 35 | + if ($request->query('current')) { |
|
| 36 | + $meetings->where(function ($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 37 | + $query->where('start_time', '=', NULL); |
|
| 38 | + } |
|
| 39 | + //to be planned |
|
| 38 | 40 | //datetime to consider timezone, don't use mysql NOW() |
| 39 | 41 | $query->orWhere('start_time', '>=', new \DateTime());//planned |
| 40 | 42 | }); |
@@ -116,9 +118,10 @@ discard block |
||
| 116 | 118 | $this->authorize($meeting); |
| 117 | 119 | $ret = self::getImg($meeting); |
| 118 | 120 | $blank = storage_path('img/meetings.jpg'); |
| 119 | - if ($ret === false) |
|
| 120 | - return (new Response(file_get_contents($blank), 200)) |
|
| 121 | + if ($ret === false) { |
|
| 122 | + return (new Response(file_get_contents($blank), 200)) |
|
| 121 | 123 | ->header('Content-Type', 'image/jpeg'); |
| 124 | + } |
|
| 122 | 125 | return (new Response($ret, 200)) |
| 123 | 126 | ->header('Content-Type', 'image/jpeg'); |
| 124 | 127 | } |
@@ -126,8 +129,9 @@ discard block |
||
| 126 | 129 | private static function getImg(Meeting $meeting) |
| 127 | 130 | { |
| 128 | 131 | $name = 'meetings/' . $meeting->id; |
| 129 | - if (!\Storage::exists($name)) |
|
| 130 | - return false; |
|
| 132 | + if (!\Storage::exists($name)) { |
|
| 133 | + return false; |
|
| 134 | + } |
|
| 131 | 135 | return \Storage::get($name); |
| 132 | 136 | } |
| 133 | 137 | |
@@ -147,8 +151,9 @@ discard block |
||
| 147 | 151 | $this->authorize($meeting); |
| 148 | 152 | $input = $request->all(); |
| 149 | 153 | //the planner cannot modify the duration of a planed meeting |
| 150 | - if ($meeting->start_time != NULL && $meeting->duration != $input['duration']) |
|
| 151 | - return Response::json(['error' => 'the meeting is already planned, you cannot change the duration'], 422); |
|
| 154 | + if ($meeting->start_time != NULL && $meeting->duration != $input['duration']) { |
|
| 155 | + return Response::json(['error' => 'the meeting is already planned, you cannot change the duration'], 422); |
|
| 156 | + } |
|
| 152 | 157 | $meeting->update($input); |
| 153 | 158 | return $meeting; |
| 154 | 159 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | * Store a newly created resource in storage. |
| 21 | 21 | * |
| 22 | 22 | * @param int $meetingId |
| 23 | - * @return static |
|
| 23 | + * @return Response |
|
| 24 | 24 | */ |
| 25 | 25 | public function showImage($meetingId) |
| 26 | 26 | { |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | public function __construct() |
| 16 | 16 | { |
| 17 | - config(['auth.model' => \plunner\Planner::class]); |
|
| 18 | - config(['jwt.user' => \plunner\Planner::class]); |
|
| 17 | + config([ 'auth.model' => \plunner\Planner::class ]); |
|
| 18 | + config([ 'jwt.user' => \plunner\Planner::class ]); |
|
| 19 | 19 | $this->middleware('jwt.authandrefresh:mode-en'); |
| 20 | 20 | } |
| 21 | 21 | |
@@ -33,10 +33,10 @@ discard block |
||
| 33 | 33 | $this->authorize($group); |
| 34 | 34 | $meetings = $group->meetings(); |
| 35 | 35 | if ($request->query('current')) |
| 36 | - $meetings->where(function ($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 37 | - $query->where('start_time', '=', NULL);//to be planned |
|
| 36 | + $meetings->where(function($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 37 | + $query->where('start_time', '=', NULL); //to be planned |
|
| 38 | 38 | //datetime to consider timezone, don't use mysql NOW() |
| 39 | - $query->orWhere('start_time', '>=', new \DateTime());//planned |
|
| 39 | + $query->orWhere('start_time', '>=', new \DateTime()); //planned |
|
| 40 | 40 | }); |
| 41 | 41 | |
| 42 | 42 | return $meetings->get(); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function storeImage(\Illuminate\Http\Request $request, $groupId, $meetingId) |
| 88 | 88 | { |
| 89 | - $this->validate($request, ['file' => 'required|image']); |
|
| 89 | + $this->validate($request, [ 'file' => 'required|image' ]); |
|
| 90 | 90 | $group = Group::findOrFail($groupId); |
| 91 | 91 | $this->authorize($group); |
| 92 | 92 | $meeting = Meeting::findOrFail($meetingId); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | private static function putImg($file, Meeting $meeting) |
| 100 | 100 | { |
| 101 | - \Storage::put('meetings/' . $meeting->id, \File::get($file)); |
|
| 101 | + \Storage::put('meetings/'.$meeting->id, \File::get($file)); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | private static function getImg(Meeting $meeting) |
| 127 | 127 | { |
| 128 | - $name = 'meetings/' . $meeting->id; |
|
| 128 | + $name = 'meetings/'.$meeting->id; |
|
| 129 | 129 | if (!\Storage::exists($name)) |
| 130 | 130 | return false; |
| 131 | 131 | return \Storage::get($name); |
@@ -147,8 +147,8 @@ discard block |
||
| 147 | 147 | $this->authorize($meeting); |
| 148 | 148 | $input = $request->all(); |
| 149 | 149 | //the planner cannot modify the duration of a planed meeting |
| 150 | - if ($meeting->start_time != NULL && $meeting->duration != $input['duration']) |
|
| 151 | - return Response::json(['error' => 'the meeting is already planned, you cannot change the duration'], 422); |
|
| 150 | + if ($meeting->start_time != NULL && $meeting->duration != $input[ 'duration' ]) |
|
| 151 | + return Response::json([ 'error' => 'the meeting is already planned, you cannot change the duration' ], 422); |
|
| 152 | 152 | $meeting->update($input); |
| 153 | 153 | return $meeting; |
| 154 | 154 | } |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | { |
| 13 | 13 | public function __construct() |
| 14 | 14 | { |
| 15 | - config(['auth.model' => Planner::class]); |
|
| 16 | - config(['jwt.user' => Planner::class]); |
|
| 15 | + config([ 'auth.model' => Planner::class ]); |
|
| 16 | + config([ 'jwt.user' => Planner::class ]); |
|
| 17 | 17 | $this->middleware('jwt.authandrefresh:mode-en'); |
| 18 | 18 | } |
| 19 | 19 | |
@@ -32,16 +32,16 @@ discard block |
||
| 32 | 32 | $planner = \Auth::user(); |
| 33 | 33 | $groups = $planner->groupsManaged(); |
| 34 | 34 | if ($request->query('current')) |
| 35 | - $groups->with(['meetings' => function ($query) { |
|
| 36 | - $query->where(function ($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 37 | - $query->where('start_time', '=', NULL);//to be planned |
|
| 35 | + $groups->with([ 'meetings' => function($query) { |
|
| 36 | + $query->where(function($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 37 | + $query->where('start_time', '=', NULL); //to be planned |
|
| 38 | 38 | //datetime to consider timezone, don't use mysql NOW() |
| 39 | - $query->orWhere('start_time', '>=', new \DateTime());//planned |
|
| 39 | + $query->orWhere('start_time', '>=', new \DateTime()); //planned |
|
| 40 | 40 | }); |
| 41 | - }]); |
|
| 41 | + } ]); |
|
| 42 | 42 | else |
| 43 | 43 | $groups->with('meetings'); |
| 44 | - return $groups->get();//both planed and to be planned |
|
| 44 | + return $groups->get(); //both planed and to be planned |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -31,16 +31,19 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | $planner = \Auth::user(); |
| 33 | 33 | $groups = $planner->groupsManaged(); |
| 34 | - if ($request->query('current')) |
|
| 35 | - $groups->with(['meetings' => function ($query) { |
|
| 34 | + if ($request->query('current')) { |
|
| 35 | + $groups->with(['meetings' => function ($query) { |
|
| 36 | 36 | $query->where(function ($query) { //parenthesis for conditions ...(C1 OR C2)... |
| 37 | - $query->where('start_time', '=', NULL);//to be planned |
|
| 37 | + $query->where('start_time', '=', NULL); |
|
| 38 | + } |
|
| 39 | + //to be planned |
|
| 38 | 40 | //datetime to consider timezone, don't use mysql NOW() |
| 39 | 41 | $query->orWhere('start_time', '>=', new \DateTime());//planned |
| 40 | 42 | }); |
| 41 | 43 | }]); |
| 42 | - else |
|
| 43 | - $groups->with('meetings'); |
|
| 44 | + else { |
|
| 45 | + $groups->with('meetings'); |
|
| 46 | + } |
|
| 44 | 47 | return $groups->get();//both planed and to be planned |
| 45 | 48 | } |
| 46 | 49 | |
@@ -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,8 +11,8 @@ discard block |
||
| 11 | 11 | { |
| 12 | 12 | public function __construct() |
| 13 | 13 | { |
| 14 | - config(['auth.model' => \plunner\Employee::class]); |
|
| 15 | - config(['jwt.user' => \plunner\Employee::class]); |
|
| 14 | + config([ 'auth.model' => \plunner\Employee::class ]); |
|
| 15 | + config([ 'jwt.user' => \plunner\Employee::class ]); |
|
| 16 | 16 | $this->middleware('jwt.authandrefresh:mode-en'); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -27,10 +27,10 @@ discard block |
||
| 27 | 27 | $employee = \Auth::user(); |
| 28 | 28 | $meetings = $employee->meetings(); |
| 29 | 29 | if ($request->query('current')) |
| 30 | - $meetings->where(function ($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 31 | - $query->where('start_time', '=', NULL);//to be planned |
|
| 30 | + $meetings->where(function($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 31 | + $query->where('start_time', '=', NULL); //to be planned |
|
| 32 | 32 | //datetime to consider timezone, don't use mysql NOW() |
| 33 | - $query->orWhere('start_time', '>=', new \DateTime());//planned |
|
| 33 | + $query->orWhere('start_time', '>=', new \DateTime()); //planned |
|
| 34 | 34 | }); |
| 35 | 35 | return $meetings->get(); |
| 36 | 36 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | private static function getImg(Meeting $meeting) |
| 74 | 74 | { |
| 75 | - $name = 'meetings/' . $meeting->id; |
|
| 75 | + $name = 'meetings/'.$meeting->id; |
|
| 76 | 76 | if (!\Storage::exists($name)) |
| 77 | 77 | return false; |
| 78 | 78 | return \Storage::get($name); |
@@ -26,9 +26,11 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | $employee = \Auth::user(); |
| 28 | 28 | $meetings = $employee->meetings(); |
| 29 | - if ($request->query('current')) |
|
| 30 | - $meetings->where(function ($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 31 | - $query->where('start_time', '=', NULL);//to be planned |
|
| 29 | + if ($request->query('current')) { |
|
| 30 | + $meetings->where(function ($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 31 | + $query->where('start_time', '=', NULL); |
|
| 32 | + } |
|
| 33 | + //to be planned |
|
| 32 | 34 | //datetime to consider timezone, don't use mysql NOW() |
| 33 | 35 | $query->orWhere('start_time', '>=', new \DateTime());//planned |
| 34 | 36 | }); |
@@ -63,9 +65,10 @@ discard block |
||
| 63 | 65 | $this->authorize($meeting); |
| 64 | 66 | $ret = self::getImg($meeting); |
| 65 | 67 | $blank = storage_path('img/meetings.jpg'); |
| 66 | - if ($ret === false) |
|
| 67 | - return (new Response(file_get_contents($blank), 200)) |
|
| 68 | + if ($ret === false) { |
|
| 69 | + return (new Response(file_get_contents($blank), 200)) |
|
| 68 | 70 | ->header('Content-Type', 'image/jpeg'); |
| 71 | + } |
|
| 69 | 72 | return (new Response($ret, 200)) |
| 70 | 73 | ->header('Content-Type', 'image/jpeg'); |
| 71 | 74 | } |
@@ -73,8 +76,9 @@ discard block |
||
| 73 | 76 | private static function getImg(Meeting $meeting) |
| 74 | 77 | { |
| 75 | 78 | $name = 'meetings/' . $meeting->id; |
| 76 | - if (!\Storage::exists($name)) |
|
| 77 | - return false; |
|
| 79 | + if (!\Storage::exists($name)) { |
|
| 80 | + return false; |
|
| 81 | + } |
|
| 78 | 82 | return \Storage::get($name); |
| 79 | 83 | } |
| 80 | 84 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | * Store a newly created resource in storage. |
| 21 | 21 | * |
| 22 | 22 | * @param int $meetingId |
| 23 | - * @return static |
|
| 23 | + * @return Response |
|
| 24 | 24 | */ |
| 25 | 25 | public function showImage($meetingId) |
| 26 | 26 | { |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | { |
| 11 | 11 | public function __construct() |
| 12 | 12 | { |
| 13 | - config(['auth.model' => \plunner\Company::class]); |
|
| 14 | - config(['jwt.user' => \plunner\Company::class]); |
|
| 13 | + config([ 'auth.model' => \plunner\Company::class ]); |
|
| 14 | + config([ 'jwt.user' => \plunner\Company::class ]); |
|
| 15 | 15 | $this->middleware('jwt.authandrefresh:mode-cn'); |
| 16 | 16 | } |
| 17 | 17 | |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | public function update(CompanyRequest $request) |
| 37 | 37 | { |
| 38 | 38 | $company = \Auth::user(); |
| 39 | - $input = $request->only(['name', 'password']); |
|
| 40 | - if (isset($input['password'])) |
|
| 41 | - $input['password'] = bcrypt($input['password']); |
|
| 39 | + $input = $request->only([ 'name', 'password' ]); |
|
| 40 | + if (isset($input[ 'password' ])) |
|
| 41 | + $input[ 'password' ] = bcrypt($input[ 'password' ]); |
|
| 42 | 42 | $company->update($input); |
| 43 | 43 | return $company; |
| 44 | 44 | } |
@@ -37,8 +37,9 @@ |
||
| 37 | 37 | { |
| 38 | 38 | $employee = \Auth::user(); |
| 39 | 39 | $input = $request->only(['name', 'password']); |
| 40 | - if (isset($input['password'])) |
|
| 41 | - $input['password'] = bcrypt($input['password']); |
|
| 40 | + if (isset($input['password'])) { |
|
| 41 | + $input['password'] = bcrypt($input['password']); |
|
| 42 | + } |
|
| 42 | 43 | $employee->update($input); |
| 43 | 44 | return $employee; |
| 44 | 45 | } |