@@ -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', 'pivot']; |
|
| 67 | + protected $hidden = [ 'password', 'remember_token', 'pivot' ]; |
|
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | 70 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
@@ -109,16 +109,16 @@ discard block |
||
| 109 | 109 | public function getEmailForPasswordReset() |
| 110 | 110 | { |
| 111 | 111 | list(, $caller) = debug_backtrace(false); |
| 112 | - if(isset($caller['class'])) |
|
| 113 | - $caller = explode('\\', $caller['class']); |
|
| 112 | + if (isset($caller[ 'class' ])) |
|
| 113 | + $caller = explode('\\', $caller[ 'class' ]); |
|
| 114 | 114 | else |
| 115 | 115 | $caller = ''; |
| 116 | 116 | |
| 117 | 117 | //check if this function is called by email sender |
| 118 | - if ((count($caller) && $caller[count($caller) - 1] == 'PasswordBroker') || (defined('HHVM_VERSION') && $caller == '')) |
|
| 118 | + if ((count($caller) && $caller[ count($caller) - 1 ] == 'PasswordBroker') || (defined('HHVM_VERSION') && $caller == '')) |
|
| 119 | 119 | return $this->email; |
| 120 | 120 | //return unique identify for token repository |
| 121 | - return $this->email . $this->company->id; |
|
| 121 | + return $this->email.$this->company->id; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | public function belongsToGroup(Group $group) |
| 129 | 129 | { |
| 130 | 130 | $group = $this->groups()->where('id', $group->id)->first(); |
| 131 | - if(is_object($group) && $group->exists) |
|
| 131 | + if (is_object($group) && $group->exists) |
|
| 132 | 132 | return true; |
| 133 | 133 | return false; |
| 134 | 134 | } |
@@ -73,12 +73,12 @@ discard block |
||
| 73 | 73 | $caldavClient = new SimpleCaldavAdapter(); |
| 74 | 74 | $caldavClient->connect($this->calendar->url, $this->calendar->username, \Crypt::decrypt($this->calendar->password)); |
| 75 | 75 | $calendars = $caldavClient->findCalendars(); |
| 76 | - $caldavClient->setCalendar($calendars[$this->calendar->calendar_name]);//TODO error if the calendar name is wrong |
|
| 76 | + $caldavClient->setCalendar($calendars[ $this->calendar->calendar_name ]); //TODO error if the calendar name is wrong |
|
| 77 | 77 | /** |
| 78 | 78 | * 26 hours before to avoid tiemezone problems and dst problems |
| 79 | 79 | * 30 days after |
| 80 | 80 | */ |
| 81 | - return $caldavClient->getEvents(date('Ymd\THis\Z', time()-93600), date('Ymd\THis\Z', time()+2592000)); |
|
| 81 | + return $caldavClient->getEvents(date('Ymd\THis\Z', time() - 93600), date('Ymd\THis\Z', time() + 2592000)); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -89,13 +89,13 @@ discard block |
||
| 89 | 89 | try |
| 90 | 90 | { |
| 91 | 91 | $events = $this->getEvents(); |
| 92 | - }catch (\it\thecsea\caldav_client_adapter\CaldavException $e) |
|
| 92 | + } catch (\it\thecsea\caldav_client_adapter\CaldavException $e) |
|
| 93 | 93 | { |
| 94 | 94 | \Event::fire(new CaldavErrorEvent($this->calendar, $e->getMessage())); |
| 95 | - return ; |
|
| 96 | - }catch(\Illuminate\Contracts\Encryption\DecryptException $e){ |
|
| 95 | + return; |
|
| 96 | + } catch (\Illuminate\Contracts\Encryption\DecryptException $e) { |
|
| 97 | 97 | \Event::fire(new CaldavErrorEvent($this->calendar, $e->getMessage())); |
| 98 | - return ; |
|
| 98 | + return; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | //remove old timeslots |
| 107 | 107 | $calendarMain->timeslots()->delete(); |
| 108 | - foreach($events as $event){ |
|
| 109 | - if(!($event = $this->parseEvent($event))) |
|
| 108 | + foreach ($events as $event) { |
|
| 109 | + if (!($event = $this->parseEvent($event))) |
|
| 110 | 110 | \Event::fire(new CaldavErrorEvent($this->calendar, 'problem during the parsing an event')); |
| 111 | 111 | else |
| 112 | 112 | $calendarMain->timeslots()->create($event); |
@@ -120,16 +120,16 @@ discard block |
||
| 120 | 120 | private function parseEvent(EventInterface $event) |
| 121 | 121 | { |
| 122 | 122 | $pattern = "/^((DTSTART;)|(DTEND;))(.*)\$/m"; |
| 123 | - if(preg_match_all($pattern, $event->getData(), $matches)){ |
|
| 124 | - if(!isset($matches[4]) || count($matches[4]) != 2) |
|
| 123 | + if (preg_match_all($pattern, $event->getData(), $matches)) { |
|
| 124 | + if (!isset($matches[ 4 ]) || count($matches[ 4 ]) != 2) |
|
| 125 | 125 | return null; |
| 126 | - $ret = []; |
|
| 127 | - if($tmp = $this->parseDate($matches[4][0])) |
|
| 128 | - $ret['time_start'] = $tmp; |
|
| 126 | + $ret = [ ]; |
|
| 127 | + if ($tmp = $this->parseDate($matches[ 4 ][ 0 ])) |
|
| 128 | + $ret[ 'time_start' ] = $tmp; |
|
| 129 | 129 | else |
| 130 | 130 | return null; |
| 131 | - if($tmp = $this->parseDate($matches[4][1])) |
|
| 132 | - $ret['time_end'] = $tmp; |
|
| 131 | + if ($tmp = $this->parseDate($matches[ 4 ][ 1 ])) |
|
| 132 | + $ret[ 'time_end' ] = $tmp; |
|
| 133 | 133 | else |
| 134 | 134 | return null; |
| 135 | 135 | return $ret; |
@@ -144,13 +144,13 @@ discard block |
||
| 144 | 144 | private function parseDate($date) |
| 145 | 145 | { |
| 146 | 146 | $pattern = "/^((TZID=)|(VALUE=))(.*):(.*)\$/m"; |
| 147 | - if(preg_match_all($pattern, $date, $matches)){ |
|
| 148 | - if($matches[1][0] == 'TZID=') |
|
| 147 | + if (preg_match_all($pattern, $date, $matches)) { |
|
| 148 | + if ($matches[ 1 ][ 0 ] == 'TZID=') |
|
| 149 | 149 | { |
| 150 | - return \DateTime::createFromFormat('Ymd\THis', $matches[5][0], new \DateTimeZone($matches[4][0])); |
|
| 151 | - }else if($matches[1][0] == 'VALUE=' && $matches[4][0] == 'DATE') |
|
| 150 | + return \DateTime::createFromFormat('Ymd\THis', $matches[ 5 ][ 0 ], new \DateTimeZone($matches[ 4 ][ 0 ])); |
|
| 151 | + } else if ($matches[ 1 ][ 0 ] == 'VALUE=' && $matches[ 4 ][ 0 ] == 'DATE') |
|
| 152 | 152 | { |
| 153 | - return \DateTime::createFromFormat('Ymd\THis', $matches[5][0].'T000000'); |
|
| 153 | + return \DateTime::createFromFormat('Ymd\THis', $matches[ 5 ][ 0 ].'T000000'); |
|
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | return null; |
@@ -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,38 +55,38 @@ 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/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/calendars', [ 'as' => 'employees.calendars.calendars', 'uses'=>'CalendarsController@getCalendars' ]); //TODO it's correct post? or not |
|
| 83 | 83 | }); |
| 84 | 84 | |
| 85 | - Route::group(['namespace' => 'Planners', 'prefix' => 'planners'], function() { |
|
| 86 | - Route::resource('groups', 'GroupsController', ['only' => ['index', 'show']]); |
|
| 85 | + Route::group([ 'namespace' => 'Planners', 'prefix' => 'planners' ], function() { |
|
| 86 | + Route::resource('groups', 'GroupsController', [ 'only' => [ 'index', 'show' ] ]); |
|
| 87 | 87 | }); |
| 88 | 88 | |
| 89 | - Route::group(['namespace' => 'Groups'], function() { |
|
| 90 | - Route::resource('groups', 'GroupsController', ['only' => ['index', 'show']]); |
|
| 89 | + Route::group([ 'namespace' => 'Groups' ], function() { |
|
| 90 | + Route::resource('groups', 'GroupsController', [ 'only' => [ 'index', 'show' ] ]); |
|
| 91 | 91 | }); |
| 92 | 92 | }); |
| 93 | 93 | \ No newline at end of file |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | public function __construct() |
| 18 | 18 | { |
| 19 | - config(['auth.model' => \plunner\Employee::class]); |
|
| 20 | - config(['jwt.user' => \plunner\Employee::class]); |
|
| 19 | + config([ 'auth.model' => \plunner\Employee::class ]); |
|
| 20 | + config([ 'jwt.user' => \plunner\Employee::class ]); |
|
| 21 | 21 | $this->middleware('jwt.authandrefresh:mode-en'); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -112,9 +112,9 @@ discard block |
||
| 112 | 112 | $caldavClient->connect($request->get('url'), $request->get('username'), $request->get('password')); |
| 113 | 113 | $calendars = $caldavClient->findCalendars(); |
| 114 | 114 | return array_keys($calendars); |
| 115 | - }catch (\it\thecsea\caldav_client_adapter\CaldavException $e) |
|
| 115 | + } catch (\it\thecsea\caldav_client_adapter\CaldavException $e) |
|
| 116 | 116 | { |
| 117 | - return \Response::json(['error' => $e->getMessage()],422); |
|
| 117 | + return \Response::json([ 'error' => $e->getMessage() ], 422); |
|
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | } |