@@ -18,8 +18,8 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | public function __construct() |
| 20 | 20 | { |
| 21 | - config(['auth.model' => Planner::class]); |
|
| 22 | - config(['jwt.user' => Planner::class]); |
|
| 21 | + config([ 'auth.model' => Planner::class ]); |
|
| 22 | + config([ 'jwt.user' => Planner::class ]); |
|
| 23 | 23 | $this->middleware('jwt.authandrefresh:mode-en'); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | * |
| 38 | 38 | * @var array |
| 39 | 39 | */ |
| 40 | - protected $fillable = ['name', 'enabled']; |
|
| 40 | + protected $fillable = [ 'name', 'enabled' ]; |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
@@ -18,36 +18,36 @@ discard block |
||
| 18 | 18 | /** |
| 19 | 19 | * Companies |
| 20 | 20 | */ |
| 21 | -Route::group(['namespace' => 'Companies', 'prefix' => 'companies'], function() { |
|
| 21 | +Route::group([ 'namespace' => 'Companies', 'prefix' => 'companies' ], function() { |
|
| 22 | 22 | |
| 23 | 23 | //\Auth |
| 24 | 24 | |
| 25 | - Route::group(['namespace' => 'Auth'], function() { |
|
| 26 | - Route::group(['prefix' => 'auth'], function () { |
|
| 25 | + Route::group([ 'namespace' => 'Auth' ], function() { |
|
| 26 | + Route::group([ 'prefix' => 'auth' ], function() { |
|
| 27 | 27 | // Authentication routes... |
| 28 | - Route::post('login', ['as' => 'companies.auth.login','uses'=>'AuthController@postLogin']); |
|
| 28 | + Route::post('login', [ 'as' => 'companies.auth.login', 'uses'=>'AuthController@postLogin' ]); |
|
| 29 | 29 | |
| 30 | 30 | // Registration routes... |
| 31 | - Route::post('register', ['as' => 'companies.auth.register', 'uses'=>'AuthController@postRegister']); |
|
| 31 | + Route::post('register', [ 'as' => 'companies.auth.register', 'uses'=>'AuthController@postRegister' ]); |
|
| 32 | 32 | |
| 33 | 33 | }); |
| 34 | 34 | |
| 35 | - Route::group(['prefix' => 'password'], function () { |
|
| 35 | + Route::group([ 'prefix' => 'password' ], function() { |
|
| 36 | 36 | // Password reset link request routes... |
| 37 | - Route::post('email', ['as' => 'companies.auth.email', 'uses'=>'PasswordController@postEmail']); |
|
| 37 | + Route::post('email', [ 'as' => 'companies.auth.email', 'uses'=>'PasswordController@postEmail' ]); |
|
| 38 | 38 | |
| 39 | 39 | // Password reset routes... |
| 40 | - Route::post('reset', ['as' => 'companies.auth.reset', 'uses'=>'PasswordController@postReset']); |
|
| 40 | + Route::post('reset', [ 'as' => 'companies.auth.reset', 'uses'=>'PasswordController@postReset' ]); |
|
| 41 | 41 | }); |
| 42 | 42 | }); |
| 43 | 43 | |
| 44 | - Route::group(['namespace' => 'Employees'], function() { |
|
| 45 | - Route::resource('employees', 'EmployeesController', ['except' => ['create', 'edit']]); |
|
| 44 | + Route::group([ 'namespace' => 'Employees' ], function() { |
|
| 45 | + Route::resource('employees', 'EmployeesController', [ 'except' => [ 'create', 'edit' ] ]); |
|
| 46 | 46 | }); |
| 47 | 47 | |
| 48 | - Route::group(['namespace' => 'Groups'], function() { |
|
| 49 | - Route::resource('groups', 'GroupsController', ['except' => ['create', 'edit']]); |
|
| 50 | - Route::resource('groups.employees', 'EmployeesController', ['only' => ['store', 'index', 'destroy']]); |
|
| 48 | + Route::group([ 'namespace' => 'Groups' ], function() { |
|
| 49 | + Route::resource('groups', 'GroupsController', [ 'except' => [ 'create', 'edit' ] ]); |
|
| 50 | + Route::resource('groups.employees', 'EmployeesController', [ 'only' => [ 'store', 'index', 'destroy' ] ]); |
|
| 51 | 51 | }); |
| 52 | 52 | }); |
| 53 | 53 | |
@@ -55,39 +55,39 @@ discard block |
||
| 55 | 55 | /** |
| 56 | 56 | * Employees |
| 57 | 57 | */ |
| 58 | -Route::group(['namespace' => 'Employees', 'prefix' => 'employees'], function() { |
|
| 58 | +Route::group([ 'namespace' => 'Employees', 'prefix' => 'employees' ], function() { |
|
| 59 | 59 | |
| 60 | 60 | //\Auth |
| 61 | - Route::group(['namespace' => 'Auth'], function() { |
|
| 62 | - Route::group(['prefix' => 'auth'], function () { |
|
| 61 | + Route::group([ 'namespace' => 'Auth' ], function() { |
|
| 62 | + Route::group([ 'prefix' => 'auth' ], function() { |
|
| 63 | 63 | // Authentication routes... |
| 64 | - Route::post('login', ['as' => 'companies.auth.login', 'uses'=>'AuthController@postLogin']); |
|
| 64 | + Route::post('login', [ 'as' => 'companies.auth.login', 'uses'=>'AuthController@postLogin' ]); |
|
| 65 | 65 | |
| 66 | 66 | // Registration routes... |
| 67 | 67 | //Route::post('register', ['as' => 'companies.auth.register', 'uses'=>'AuthController@postRegister']); //the registration is managed by the company |
| 68 | 68 | |
| 69 | 69 | }); |
| 70 | 70 | |
| 71 | - Route::group(['prefix' => 'password'], function () { |
|
| 71 | + Route::group([ 'prefix' => 'password' ], function() { |
|
| 72 | 72 | // Password reset link request routes... |
| 73 | - Route::post('email', ['as' => 'companies.auth.email', 'uses'=>'PasswordController@postEmail']); |
|
| 73 | + Route::post('email', [ 'as' => 'companies.auth.email', 'uses'=>'PasswordController@postEmail' ]); |
|
| 74 | 74 | |
| 75 | 75 | // Password reset routes... |
| 76 | - Route::post('reset', ['as' => 'companies.auth.reset', 'uses'=>'PasswordController@postReset']); |
|
| 76 | + Route::post('reset', [ 'as' => 'companies.auth.reset', 'uses'=>'PasswordController@postReset' ]); |
|
| 77 | 77 | }); |
| 78 | 78 | }); |
| 79 | 79 | |
| 80 | - Route::group(['namespace' => 'Calendars'], function() { |
|
| 81 | - Route::resource('calendars', 'CalendarsController', ['except' => ['create', 'edit']]); |
|
| 82 | - Route::post('calendars/caldav', ['as' => 'employees.calendars.caldav','uses'=>'CalendarsController@storeCaldav']); |
|
| 83 | - Route::post('calendars/calendars', ['as' => 'employees.calendars.calendars','uses'=>'CalendarsController@getCalendars']); //TODO it's correct post? or not |
|
| 80 | + Route::group([ 'namespace' => 'Calendars' ], function() { |
|
| 81 | + Route::resource('calendars', 'CalendarsController', [ 'except' => [ 'create', 'edit' ] ]); |
|
| 82 | + Route::post('calendars/caldav', [ 'as' => 'employees.calendars.caldav', 'uses'=>'CalendarsController@storeCaldav' ]); |
|
| 83 | + Route::post('calendars/calendars', [ 'as' => 'employees.calendars.calendars', 'uses'=>'CalendarsController@getCalendars' ]); //TODO it's correct post? or not |
|
| 84 | 84 | }); |
| 85 | 85 | |
| 86 | - Route::group(['namespace' => 'Planners', 'prefix' => 'planners'], function() { |
|
| 87 | - Route::resource('groups', 'GroupsController', ['only' => ['index', 'show']]); |
|
| 86 | + Route::group([ 'namespace' => 'Planners', 'prefix' => 'planners' ], function() { |
|
| 87 | + Route::resource('groups', 'GroupsController', [ 'only' => [ 'index', 'show' ] ]); |
|
| 88 | 88 | }); |
| 89 | 89 | |
| 90 | - Route::group(['namespace' => 'Groups'], function() { |
|
| 91 | - Route::resource('groups', 'GroupsController', ['only' => ['index', 'show']]); |
|
| 90 | + Route::group([ 'namespace' => 'Groups' ], function() { |
|
| 91 | + Route::resource('groups', 'GroupsController', [ 'only' => [ 'index', 'show' ] ]); |
|
| 92 | 92 | }); |
| 93 | 93 | }); |
| 94 | 94 | \ No newline at end of file |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | * |
| 47 | 47 | * @var array |
| 48 | 48 | */ |
| 49 | - protected $fillable = ['title', 'description', 'duration']; |
|
| 49 | + protected $fillable = [ 'title', 'description', 'duration' ]; |
|
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -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 | { |
@@ -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 | } |