@@ -2,14 +2,11 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace plunner\Http\Controllers\Employees\Planners; |
| 4 | 4 | |
| 5 | -use Illuminate\Http\Request; |
|
| 6 | - |
|
| 7 | -use plunner\Http\Requests; |
|
| 8 | -use plunner\Http\Requests\Employees\MeetingRequest; |
|
| 9 | 5 | use plunner\Http\Controllers\Controller; |
| 6 | +use plunner\Http\Requests\Employees\MeetingRequest; |
|
| 10 | 7 | |
| 11 | -use plunner\Meeting; |
|
| 12 | 8 | use plunner\Group; |
| 9 | +use plunner\Meeting; |
|
| 13 | 10 | |
| 14 | 11 | class MeetingsController extends Controller |
| 15 | 12 | { |
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function __construct() |
| 20 | 20 | { |
| 21 | - config(['auth.model' => \plunner\Planner::class]); |
|
| 22 | - config(['jwt.user' => \plunner\Planner::class]); |
|
| 21 | + config([ 'auth.model' => \plunner\Planner::class ]); |
|
| 22 | + config([ 'jwt.user' => \plunner\Planner::class ]); |
|
| 23 | 23 | $this->middleware('jwt.authandrefresh:mode-en'); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | { |
| 61 | 61 | return in_array($title, array_map(function($meeting) |
| 62 | 62 | { |
| 63 | - return $meeting['title']; |
|
| 63 | + return $meeting[ 'title' ]; |
|
| 64 | 64 | }, |
| 65 | 65 | $group->meetings->toArray())); |
| 66 | 66 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $group = Group::findOrFail($groupId); |
| 78 | 78 | $this->authorize($group); |
| 79 | 79 | $input = $request->all(); |
| 80 | - if ($this->checkTitleAlreadyExists($input['title'], $group))//TODO create methods inside model is nto the correct way |
|
| 80 | + if ($this->checkTitleAlreadyExists($input[ 'title' ], $group))//TODO create methods inside model is nto the correct way |
|
| 81 | 81 | { |
| 82 | 82 | abort(422); //TODO thsi is note the correct way |
| 83 | 83 | //TODO This is not a contraint to do. but anyway if we want to do constraints we have to use requests |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $group = Group::findOrFail($groupId); |
| 102 | 102 | $this->authorize($group); |
| 103 | 103 | $input = $request->all(); |
| 104 | - if ($this->checkTitleAlreadyExists($input['title'], $group)) |
|
| 104 | + if ($this->checkTitleAlreadyExists($input[ 'title' ], $group)) |
|
| 105 | 105 | { |
| 106 | 106 | abort(422); |
| 107 | 107 | } |
@@ -77,9 +77,12 @@ |
||
| 77 | 77 | $group = Group::findOrFail($groupId); |
| 78 | 78 | $this->authorize($group); |
| 79 | 79 | $input = $request->all(); |
| 80 | - if ($this->checkTitleAlreadyExists($input['title'], $group))//TODO create methods inside model is nto the correct way |
|
| 80 | + if ($this->checkTitleAlreadyExists($input['title'], $group)) { |
|
| 81 | + //TODO create methods inside model is nto the correct way |
|
| 81 | 82 | { |
| 82 | - abort(422); //TODO thsi is note the correct way |
|
| 83 | + abort(422); |
|
| 84 | + } |
|
| 85 | + //TODO thsi is note the correct way |
|
| 83 | 86 | //TODO This is not a contraint to do. but anyway if we want to do constraints we have to use requests |
| 84 | 87 | } |
| 85 | 88 | $meeting = $group->meetings()->create($input); |
@@ -2,13 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace plunner\Http\Controllers\Employees\Planners; |
| 4 | 4 | |
| 5 | -use Illuminate\Http\Request; |
|
| 6 | - |
|
| 7 | -use plunner\Http\Requests; |
|
| 8 | -use plunner\Http\Requests\Employees\MeetingRequest; |
|
| 9 | 5 | use plunner\Http\Controllers\Controller; |
| 10 | - |
|
| 11 | -use plunner\Meeting; |
|
| 6 | +use plunner\Http\Requests\Employees\MeetingRequest; |
|
| 12 | 7 | |
| 13 | 8 | class MeetingTimeslotsController extends Controller |
| 14 | 9 | { |
@@ -17,8 +17,8 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function __construct() |
| 19 | 19 | { |
| 20 | - config(['auth.model' => \plunner\Planner::class]); |
|
| 21 | - config(['jwt.user' => \plunner\Planner::class]); |
|
| 20 | + config([ 'auth.model' => \plunner\Planner::class ]); |
|
| 21 | + config([ 'jwt.user' => \plunner\Planner::class ]); |
|
| 22 | 22 | $this->middleware('jwt.authandrefresh:mode-en'); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -50,19 +50,19 @@ 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 | * @var array |
| 64 | 64 | */ |
| 65 | - protected $appends = ['is_planner']; |
|
| 65 | + protected $appends = [ 'is_planner' ]; |
|
| 66 | 66 | |
| 67 | 67 | public function getIsPlannerAttribute() |
| 68 | 68 | { |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * to get all meetings where the user can go user groups with meetings |
| 99 | 99 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
| 100 | 100 | */ |
| 101 | - public function meetings(){ |
|
| 101 | + public function meetings() { |
|
| 102 | 102 | //TODO durign the inserting chek if the meeting is of a group of the user |
| 103 | 103 | return $this->belongsToMany(Meeting::class); |
| 104 | 104 | } |
@@ -114,16 +114,16 @@ discard block |
||
| 114 | 114 | public function getEmailForPasswordReset() |
| 115 | 115 | { |
| 116 | 116 | list(, $caller) = debug_backtrace(false); |
| 117 | - if(isset($caller['class'])) |
|
| 118 | - $caller = explode('\\', $caller['class']); |
|
| 117 | + if (isset($caller[ 'class' ])) |
|
| 118 | + $caller = explode('\\', $caller[ 'class' ]); |
|
| 119 | 119 | else |
| 120 | 120 | $caller = ''; |
| 121 | 121 | |
| 122 | 122 | //check if this function is called by email sender |
| 123 | - if ((count($caller) && $caller[count($caller) - 1] == 'PasswordBroker') || (defined('HHVM_VERSION') && $caller == '')) |
|
| 123 | + if ((count($caller) && $caller[ count($caller) - 1 ] == 'PasswordBroker') || (defined('HHVM_VERSION') && $caller == '')) |
|
| 124 | 124 | return $this->email; |
| 125 | 125 | //return unique identify for token repository |
| 126 | - return $this->email . $this->company->id; |
|
| 126 | + return $this->email.$this->company->id; |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -114,14 +114,16 @@ |
||
| 114 | 114 | public function getEmailForPasswordReset() |
| 115 | 115 | { |
| 116 | 116 | list(, $caller) = debug_backtrace(false); |
| 117 | - if(isset($caller['class'])) |
|
| 118 | - $caller = explode('\\', $caller['class']); |
|
| 119 | - else |
|
| 120 | - $caller = ''; |
|
| 117 | + if(isset($caller['class'])) { |
|
| 118 | + $caller = explode('\\', $caller['class']); |
|
| 119 | + } else { |
|
| 120 | + $caller = ''; |
|
| 121 | + } |
|
| 121 | 122 | |
| 122 | 123 | //check if this function is called by email sender |
| 123 | - if ((count($caller) && $caller[count($caller) - 1] == 'PasswordBroker') || (defined('HHVM_VERSION') && $caller == '')) |
|
| 124 | - return $this->email; |
|
| 124 | + if ((count($caller) && $caller[count($caller) - 1] == 'PasswordBroker') || (defined('HHVM_VERSION') && $caller == '')) { |
|
| 125 | + return $this->email; |
|
| 126 | + } |
|
| 125 | 127 | //return unique identify for token repository |
| 126 | 128 | return $this->email . $this->company->id; |
| 127 | 129 | } |
@@ -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 | |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | public function index() |
| 30 | 30 | { |
| 31 | 31 | $employee = \Auth::user(); |
| 32 | - return $employee->groups()->with(['meetings'=>function($query) { |
|
| 32 | + return $employee->groups()->with([ 'meetings'=>function($query) { |
|
| 33 | 33 | $query->where('start_time', '=', NULL); |
| 34 | - }])->get(); |
|
| 34 | + } ])->get(); |
|
| 35 | 35 | //TODO get only current meetings |
| 36 | 36 | } |
| 37 | 37 | |
@@ -19,41 +19,41 @@ discard block |
||
| 19 | 19 | * Companies |
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | -Route::group(['namespace' => 'Companies', 'prefix' => 'companies'], function() { |
|
| 22 | +Route::group([ 'namespace' => 'Companies', 'prefix' => 'companies' ], function() { |
|
| 23 | 23 | |
| 24 | 24 | //\Auth |
| 25 | 25 | |
| 26 | - Route::group(['namespace' => 'Auth'], function() { |
|
| 27 | - Route::group(['prefix' => 'auth'], function () { |
|
| 26 | + Route::group([ 'namespace' => 'Auth' ], function() { |
|
| 27 | + Route::group([ 'prefix' => 'auth' ], function() { |
|
| 28 | 28 | // Authentication routes... |
| 29 | - Route::post('login', ['as' => 'companies.auth.login','uses'=>'AuthController@postLogin']); |
|
| 29 | + Route::post('login', [ 'as' => 'companies.auth.login', 'uses'=>'AuthController@postLogin' ]); |
|
| 30 | 30 | |
| 31 | 31 | // Registration routes... |
| 32 | - Route::post('register', ['as' => 'companies.auth.register', 'uses'=>'AuthController@postRegister']); |
|
| 32 | + Route::post('register', [ 'as' => 'companies.auth.register', 'uses'=>'AuthController@postRegister' ]); |
|
| 33 | 33 | |
| 34 | 34 | }); |
| 35 | 35 | |
| 36 | - Route::group(['prefix' => 'password'], function () { |
|
| 36 | + Route::group([ 'prefix' => 'password' ], function() { |
|
| 37 | 37 | // Password reset link request routes... |
| 38 | - Route::post('email', ['as' => 'companies.auth.email', 'uses'=>'PasswordController@postEmail']); |
|
| 38 | + Route::post('email', [ 'as' => 'companies.auth.email', 'uses'=>'PasswordController@postEmail' ]); |
|
| 39 | 39 | |
| 40 | 40 | // Password reset routes... |
| 41 | - Route::post('reset', ['as' => 'companies.auth.reset', 'uses'=>'PasswordController@postReset']); |
|
| 41 | + Route::post('reset', [ 'as' => 'companies.auth.reset', 'uses'=>'PasswordController@postReset' ]); |
|
| 42 | 42 | }); |
| 43 | 43 | }); |
| 44 | 44 | |
| 45 | - Route::group(['namespace' => 'Employees'], function() { |
|
| 46 | - Route::resource('employees', 'EmployeesController', ['except' => ['create', 'edit']]); |
|
| 45 | + Route::group([ 'namespace' => 'Employees' ], function() { |
|
| 46 | + Route::resource('employees', 'EmployeesController', [ 'except' => [ 'create', 'edit' ] ]); |
|
| 47 | 47 | }); |
| 48 | 48 | |
| 49 | - Route::group(['namespace' => 'Groups'], function() { |
|
| 50 | - Route::resource('groups', 'GroupsController', ['except' => ['create', 'edit']]); |
|
| 51 | - Route::resource('groups.employees', 'EmployeesController', ['only' => ['store', 'index', 'destroy']]); |
|
| 49 | + Route::group([ 'namespace' => 'Groups' ], function() { |
|
| 50 | + Route::resource('groups', 'GroupsController', [ 'except' => [ 'create', 'edit' ] ]); |
|
| 51 | + Route::resource('groups.employees', 'EmployeesController', [ 'only' => [ 'store', 'index', 'destroy' ] ]); |
|
| 52 | 52 | }); |
| 53 | 53 | |
| 54 | - Route::group(['namespace' => 'Company', 'prefix' => 'company'], function() { |
|
| 55 | - Route::get('/', ['as' => 'companies.company.index', 'uses' => 'CompanyController@index']); |
|
| 56 | - Route::put('/', ['as' => 'companies.company.update', 'uses' => 'CompanyController@update']); |
|
| 54 | + Route::group([ 'namespace' => 'Company', 'prefix' => 'company' ], function() { |
|
| 55 | + Route::get('/', [ 'as' => 'companies.company.index', 'uses' => 'CompanyController@index' ]); |
|
| 56 | + Route::put('/', [ 'as' => 'companies.company.update', 'uses' => 'CompanyController@update' ]); |
|
| 57 | 57 | }); |
| 58 | 58 | }); |
| 59 | 59 | |
@@ -61,46 +61,46 @@ discard block |
||
| 61 | 61 | /** |
| 62 | 62 | * Employees |
| 63 | 63 | */ |
| 64 | -Route::group(['namespace' => 'Employees', 'prefix' => 'employees'], function() { |
|
| 64 | +Route::group([ 'namespace' => 'Employees', 'prefix' => 'employees' ], function() { |
|
| 65 | 65 | |
| 66 | 66 | //\Auth |
| 67 | - Route::group(['namespace' => 'Auth'], function() { |
|
| 68 | - Route::group(['prefix' => 'auth'], function () { |
|
| 67 | + Route::group([ 'namespace' => 'Auth' ], function() { |
|
| 68 | + Route::group([ 'prefix' => 'auth' ], function() { |
|
| 69 | 69 | // Authentication routes... |
| 70 | - Route::post('login', ['as' => 'companies.auth.login', 'uses'=>'AuthController@postLogin']); |
|
| 70 | + Route::post('login', [ 'as' => 'companies.auth.login', 'uses'=>'AuthController@postLogin' ]); |
|
| 71 | 71 | |
| 72 | 72 | // Registration routes... |
| 73 | 73 | //Route::post('register', ['as' => 'companies.auth.register', 'uses'=>'AuthController@postRegister']); //the registration is managed by the company |
| 74 | 74 | |
| 75 | 75 | }); |
| 76 | 76 | |
| 77 | - Route::group(['prefix' => 'password'], function () { |
|
| 77 | + Route::group([ 'prefix' => 'password' ], function() { |
|
| 78 | 78 | // Password reset link request routes... |
| 79 | - Route::post('email', ['as' => 'companies.auth.email', 'uses'=>'PasswordController@postEmail']); |
|
| 79 | + Route::post('email', [ 'as' => 'companies.auth.email', 'uses'=>'PasswordController@postEmail' ]); |
|
| 80 | 80 | |
| 81 | 81 | // Password reset routes... |
| 82 | - Route::post('reset', ['as' => 'companies.auth.reset', 'uses'=>'PasswordController@postReset']); |
|
| 82 | + Route::post('reset', [ 'as' => 'companies.auth.reset', 'uses'=>'PasswordController@postReset' ]); |
|
| 83 | 83 | }); |
| 84 | 84 | }); |
| 85 | 85 | |
| 86 | - Route::group(['namespace' => 'Calendars'], function() { |
|
| 87 | - Route::resource('calendars', 'CalendarsController', ['except' => ['create', 'edit']]); |
|
| 88 | - Route::post('calendars/caldav', ['as' => 'employees.calendars.caldav','uses'=>'CalendarsController@storeCaldav']); |
|
| 89 | - Route::post('calendars/calendars', ['as' => 'employees.calendars.calendars','uses'=>'CalendarsController@getCalendars']); //TODO it's correct post? or not |
|
| 86 | + Route::group([ 'namespace' => 'Calendars' ], function() { |
|
| 87 | + Route::resource('calendars', 'CalendarsController', [ 'except' => [ 'create', 'edit' ] ]); |
|
| 88 | + Route::post('calendars/caldav', [ 'as' => 'employees.calendars.caldav', 'uses'=>'CalendarsController@storeCaldav' ]); |
|
| 89 | + Route::post('calendars/calendars', [ 'as' => 'employees.calendars.calendars', 'uses'=>'CalendarsController@getCalendars' ]); //TODO it's correct post? or not |
|
| 90 | 90 | }); |
| 91 | 91 | |
| 92 | - Route::group(['namespace' => 'Planners', 'prefix' => 'planners'], function() { |
|
| 93 | - Route::resource('groups', 'GroupsController', ['only' => ['index', 'show']]); |
|
| 94 | - Route::resource('groups.meetings', 'MeetingsController', ['except' => ['create', 'edit']]); |
|
| 95 | - Route::resource('groups.meetings.timeslots', 'MeetingTimeslotsController', ['except' => ['create', 'edit']]); |
|
| 92 | + Route::group([ 'namespace' => 'Planners', 'prefix' => 'planners' ], function() { |
|
| 93 | + Route::resource('groups', 'GroupsController', [ 'only' => [ 'index', 'show' ] ]); |
|
| 94 | + Route::resource('groups.meetings', 'MeetingsController', [ 'except' => [ 'create', 'edit' ] ]); |
|
| 95 | + Route::resource('groups.meetings.timeslots', 'MeetingTimeslotsController', [ 'except' => [ 'create', 'edit' ] ]); |
|
| 96 | 96 | }); |
| 97 | 97 | |
| 98 | - Route::group(['namespace' => 'Groups'], function() { |
|
| 99 | - Route::resource('groups', 'GroupsController', ['only' => ['index', 'show']]); |
|
| 98 | + Route::group([ 'namespace' => 'Groups' ], function() { |
|
| 99 | + Route::resource('groups', 'GroupsController', [ 'only' => [ 'index', 'show' ] ]); |
|
| 100 | 100 | }); |
| 101 | 101 | |
| 102 | - Route::group(['namespace' => 'Employee', 'prefix' => 'employee'], function() { |
|
| 103 | - Route::get('/', ['as' => 'employees.employee.index', 'uses' => 'EmployeeController@index']); |
|
| 104 | - Route::put('/', ['as' => 'employees.employee.update', 'uses' => 'EmployeeController@update']); |
|
| 102 | + Route::group([ 'namespace' => 'Employee', 'prefix' => 'employee' ], function() { |
|
| 103 | + Route::get('/', [ 'as' => 'employees.employee.index', 'uses' => 'EmployeeController@index' ]); |
|
| 104 | + Route::put('/', [ 'as' => 'employees.employee.update', 'uses' => 'EmployeeController@update' ]); |
|
| 105 | 105 | }); |
| 106 | 106 | }); |
| 107 | 107 | \ No newline at end of file |