@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function __construct() |
19 | 19 | { |
20 | - config(['auth.model' => \plunner\Employee::class]); |
|
21 | - config(['jwt.user' => \plunner\Employee::class]); |
|
20 | + config([ 'auth.model' => \plunner\Employee::class ]); |
|
21 | + config([ 'jwt.user' => \plunner\Employee::class ]); |
|
22 | 22 | $this->middleware('jwt.authandrefresh:mode-en'); |
23 | 23 | } |
24 | 24 | |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | $employee = \Auth::user(); |
67 | 67 | $input = $request->all(); |
68 | 68 | $calendar = $employee->calendars()->create($input); |
69 | - if(isset($input['password'])) |
|
70 | - $input['password'] = \Crypt::encrypt($input['password']); |
|
69 | + if (isset($input[ 'password' ])) |
|
70 | + $input[ 'password' ] = \Crypt::encrypt($input[ 'password' ]); |
|
71 | 71 | $calendar->caldav()->create($input); |
72 | 72 | //TODO test |
73 | 73 | //TODO validator |
@@ -104,17 +104,17 @@ discard block |
||
104 | 104 | $this->authorize($calendar); |
105 | 105 | $input = $request->all(); |
106 | 106 | $caldav = $calendar->caldav; |
107 | - if($caldav){ |
|
107 | + if ($caldav) { |
|
108 | 108 | $this->validateCaldav($request); |
109 | 109 | } |
110 | - if(isset($input['password'])) |
|
111 | - $input['password'] = \Crypt::encrypt($input['password']); |
|
110 | + if (isset($input[ 'password' ])) |
|
111 | + $input[ 'password' ] = \Crypt::encrypt($input[ 'password' ]); |
|
112 | 112 | $calendar->update($input); |
113 | 113 | //TODO test |
114 | 114 | //TODO validator |
115 | 115 | //TODO check if caldav exists? |
116 | 116 | |
117 | - if($caldav) |
|
117 | + if ($caldav) |
|
118 | 118 | $caldav->update($input); |
119 | 119 | return $calendar; |
120 | 120 | } |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | $caldavClient->connect($request->input('url'), $request->input('username'), $request->input('password')); |
149 | 149 | $calendars = $caldavClient->findCalendars(); |
150 | 150 | return array_keys($calendars); |
151 | - }catch (\it\thecsea\caldav_client_adapter\CaldavException $e) |
|
151 | + } catch (\it\thecsea\caldav_client_adapter\CaldavException $e) |
|
152 | 152 | { |
153 | - return Response::json(['error' => $e->getMessage()],422); |
|
153 | + return Response::json([ 'error' => $e->getMessage() ], 422); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $this->validate($request, [ |
163 | 163 | 'url' => 'required|max:255', |
164 | 164 | 'username' => 'required|max:255', |
165 | - 'password' => ((\Route::current()->getName() == 'companies.calendars.caldav')?'required':''), |
|
165 | + 'password' => ((\Route::current()->getName() == 'companies.calendars.caldav') ? 'required' : ''), |
|
166 | 166 | 'calendar_name' => 'required|max:255', |
167 | 167 | ]); |
168 | 168 | } |
@@ -66,8 +66,9 @@ discard block |
||
66 | 66 | $employee = \Auth::user(); |
67 | 67 | $input = $request->all(); |
68 | 68 | $calendar = $employee->calendars()->create($input); |
69 | - if(isset($input['password'])) |
|
70 | - $input['password'] = \Crypt::encrypt($input['password']); |
|
69 | + if(isset($input['password'])) { |
|
70 | + $input['password'] = \Crypt::encrypt($input['password']); |
|
71 | + } |
|
71 | 72 | $calendar->caldav()->create($input); |
72 | 73 | //TODO test |
73 | 74 | //TODO validator |
@@ -107,15 +108,17 @@ discard block |
||
107 | 108 | if($caldav){ |
108 | 109 | $this->validateCaldav($request); |
109 | 110 | } |
110 | - if(isset($input['password'])) |
|
111 | - $input['password'] = \Crypt::encrypt($input['password']); |
|
111 | + if(isset($input['password'])) { |
|
112 | + $input['password'] = \Crypt::encrypt($input['password']); |
|
113 | + } |
|
112 | 114 | $calendar->update($input); |
113 | 115 | //TODO test |
114 | 116 | //TODO validator |
115 | 117 | //TODO check if caldav exists? |
116 | 118 | |
117 | - if($caldav) |
|
118 | - $caldav->update($input); |
|
119 | + if($caldav) { |
|
120 | + $caldav->update($input); |
|
121 | + } |
|
119 | 122 | return $calendar; |
120 | 123 | } |
121 | 124 | |
@@ -148,7 +151,7 @@ discard block |
||
148 | 151 | $caldavClient->connect($request->input('url'), $request->input('username'), $request->input('password')); |
149 | 152 | $calendars = $caldavClient->findCalendars(); |
150 | 153 | return array_keys($calendars); |
151 | - }catch (\it\thecsea\caldav_client_adapter\CaldavException $e) |
|
154 | + } catch (\it\thecsea\caldav_client_adapter\CaldavException $e) |
|
152 | 155 | { |
153 | 156 | return Response::json(['error' => $e->getMessage()],422); |
154 | 157 | } |