@@ -30,6 +30,6 @@ |
||
30 | 30 | 'auth' => \plunner\Http\Middleware\Authenticate::class, |
31 | 31 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, |
32 | 32 | 'guest' => \plunner\Http\Middleware\RedirectIfAuthenticated::class, |
33 | - 'jwt.authandrefresh' => \plunner\Http\Middleware\GetUserAndRefresh::class,//'Tymon\JWTAuth\Middleware\GetUserAndRefresh', |
|
33 | + 'jwt.authandrefresh' => \plunner\Http\Middleware\GetUserAndRefresh::class, //'Tymon\JWTAuth\Middleware\GetUserAndRefresh', |
|
34 | 34 | ]; |
35 | 35 | } |
@@ -25,15 +25,15 @@ |
||
25 | 25 | public function handle($request, \Closure $next, $custom = '') |
26 | 26 | { |
27 | 27 | $remember = false; |
28 | - if($this->auth->setRequest($request)->getToken() && ($remember = $this->auth->getPayload()->get('remember')) && |
|
29 | - $remember == 'true'){ |
|
28 | + if ($this->auth->setRequest($request)->getToken() && ($remember = $this->auth->getPayload()->get('remember')) && |
|
29 | + $remember == 'true') { |
|
30 | 30 | JWTFactory::setTTL(43200); |
31 | 31 | //config(['jwt.ttl' =>'43200']); //30 days |
32 | 32 | } |
33 | 33 | |
34 | 34 | //this to add the remember me mode field in the new token, but we have the custom check that is an useless |
35 | 35 | //overhead |
36 | - $custom = $custom.';remember-'.$remember=='true'?'true':'false'; |
|
36 | + $custom = $custom.';remember-'.$remember == 'true' ? 'true' : 'false'; |
|
37 | 37 | return parent::handle($request, $next, $custom); |
38 | 38 | } |
39 | 39 |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | { |
11 | 11 | public function __construct() |
12 | 12 | { |
13 | - config(['auth.model' => \plunner\Company::class]); |
|
14 | - config(['jwt.user' => \plunner\Company::class]); |
|
13 | + config([ 'auth.model' => \plunner\Company::class ]); |
|
14 | + config([ 'jwt.user' => \plunner\Company::class ]); |
|
15 | 15 | $this->middleware('jwt.authandrefresh:mode-cn'); |
16 | 16 | } |
17 | 17 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public function update(CompanyRequest $request) |
37 | 37 | { |
38 | 38 | $company = \Auth::user(); |
39 | - $input = $request->only(['name', 'password']); |
|
39 | + $input = $request->only([ 'name', 'password' ]); |
|
40 | 40 | $company->update($input); |
41 | 41 | return $company; |
42 | 42 | } |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | { |
11 | 11 | public function __construct() |
12 | 12 | { |
13 | - config(['auth.model' => \plunner\Employee::class]); |
|
14 | - config(['jwt.user' => \plunner\Employee::class]); |
|
13 | + config([ 'auth.model' => \plunner\Employee::class ]); |
|
14 | + config([ 'jwt.user' => \plunner\Employee::class ]); |
|
15 | 15 | $this->middleware('jwt.authandrefresh:mode-en'); |
16 | 16 | } |
17 | 17 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public function update(EmployeeRequest $request) |
37 | 37 | { |
38 | 38 | $employee = \Auth::user(); |
39 | - $input = $request->only(['name', 'password']); |
|
39 | + $input = $request->only([ 'name', 'password' ]); |
|
40 | 40 | $employee->update($input); |
41 | 41 | return $employee; |
42 | 42 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | return [ |
35 | 35 | 'name' => 'required|min:1|max:255', |
36 | 36 | 'email' => 'required|email|max:255|unique:employees,email,'.$this->route('employees').',id,company_id,'.$this->user()->id, |
37 | - 'password' => ((\Route::current()->getName() == 'companies.employees.store')?'sometimes|':'').'required|confirmed|min:6', |
|
37 | + 'password' => ((\Route::current()->getName() == 'companies.employees.store') ? 'sometimes|' : '').'required|confirmed|min:6', |
|
38 | 38 | ]; |
39 | 39 | } |
40 | 40 | } |
@@ -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 | /** |
@@ -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 |
@@ -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 |
@@ -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 | } |