@@ -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 |
@@ -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 | } |
@@ -39,6 +39,6 @@ |
||
39 | 39 | */ |
40 | 40 | public function broadcastOn() |
41 | 41 | { |
42 | - return []; |
|
42 | + return [ ]; |
|
43 | 43 | } |
44 | 44 | } |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @var array |
52 | 52 | */ |
53 | - protected $fillable = ['name', 'email', 'password']; |
|
53 | + protected $fillable = [ 'name', 'email', 'password' ]; |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * The attributes excluded from the model's JSON form. |
57 | 57 | * |
58 | 58 | * @var array |
59 | 59 | */ |
60 | - protected $hidden = ['password', 'remember_token', 'pivot']; |
|
60 | + protected $hidden = [ 'password', 'remember_token', 'pivot' ]; |
|
61 | 61 | |
62 | 62 | /** |
63 | 63 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * to get all meetings where the user can go user groups with meetings |
89 | 89 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
90 | 90 | */ |
91 | - public function meetings(){ |
|
91 | + public function meetings() { |
|
92 | 92 | //TODO durign the inserting chek if the meeting is of a group of the user |
93 | 93 | return $this->belongsToMany(Meeting::class); |
94 | 94 | } |
@@ -104,16 +104,16 @@ discard block |
||
104 | 104 | public function getEmailForPasswordReset() |
105 | 105 | { |
106 | 106 | list(, $caller) = debug_backtrace(false); |
107 | - if(isset($caller['class'])) |
|
108 | - $caller = explode('\\', $caller['class']); |
|
107 | + if (isset($caller[ 'class' ])) |
|
108 | + $caller = explode('\\', $caller[ 'class' ]); |
|
109 | 109 | else |
110 | 110 | $caller = ''; |
111 | 111 | |
112 | 112 | //check if this function is called by email sender |
113 | - if ((count($caller) && $caller[count($caller) - 1] == 'PasswordBroker') || (defined('HHVM_VERSION') && $caller == '')) |
|
113 | + if ((count($caller) && $caller[ count($caller) - 1 ] == 'PasswordBroker') || (defined('HHVM_VERSION') && $caller == '')) |
|
114 | 114 | return $this->email; |
115 | 115 | //return unique identify for token repository |
116 | - return $this->email . $this->company->id; |
|
116 | + return $this->email.$this->company->id; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | public function belongsToGroup(Group $group) |
124 | 124 | { |
125 | 125 | $group = $this->groups()->where('id', $group->id)->first(); |
126 | - if(is_object($group) && $group->exists) |
|
126 | + if (is_object($group) && $group->exists) |
|
127 | 127 | return true; |
128 | 128 | return false; |
129 | 129 | } |
@@ -46,14 +46,14 @@ |
||
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 | * The attributes excluded from the model's JSON form. |
53 | 53 | * |
54 | 54 | * @var array |
55 | 55 | */ |
56 | - protected $hidden = ['pivot']; |
|
56 | + protected $hidden = [ 'pivot' ]; |
|
57 | 57 | |
58 | 58 | |
59 | 59 | /** |