@@ -39,6 +39,6 @@ |
||
39 | 39 | */ |
40 | 40 | public function broadcastOn() |
41 | 41 | { |
42 | - return []; |
|
42 | + return [ ]; |
|
43 | 43 | } |
44 | 44 | } |
@@ -48,14 +48,14 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @var array |
50 | 50 | */ |
51 | - protected $fillable = ['name', 'email', 'password']; |
|
51 | + protected $fillable = [ 'name', 'email', 'password' ]; |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * The attributes excluded from the model's JSON form. |
55 | 55 | * |
56 | 56 | * @var array |
57 | 57 | */ |
58 | - protected $hidden = ['password', 'remember_token']; |
|
58 | + protected $hidden = [ 'password', 'remember_token' ]; |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | ->where('calendars.enabled', '=', '1') |
121 | 121 | ->where('timeslots.time_start', '>=', $from) |
122 | 122 | ->where('timeslots.time_end', '<=', $to) |
123 | - ->where('employees.company_id','=', $this->id) |
|
124 | - ->select('employees.id','timeslots.time_start','timeslots.time_end') |
|
123 | + ->where('employees.company_id', '=', $this->id) |
|
124 | + ->select('employees.id', 'timeslots.time_start', 'timeslots.time_end') |
|
125 | 125 | ->get(); |
126 | 126 | } |
127 | 127 | |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | ->join('meeting_timeslots', 'meetings.id', '=', 'meeting_timeslots.meeting_id') |
138 | 138 | ->where('meeting_timeslots.time_start', '>=', $from) |
139 | 139 | ->where('meeting_timeslots.time_end', '<=', $to) |
140 | - ->where('groups.company_id','=', $this->id) |
|
141 | - ->where('meetings.start_time','=', NULL) |
|
142 | - ->select('meetings.id', 'meetings.duration','meeting_timeslots.time_start','meeting_timeslots.time_end') |
|
140 | + ->where('groups.company_id', '=', $this->id) |
|
141 | + ->where('meetings.start_time', '=', NULL) |
|
142 | + ->select('meetings.id', 'meetings.duration', 'meeting_timeslots.time_start', 'meeting_timeslots.time_end') |
|
143 | 143 | ->get(); |
144 | 144 | } |
145 | 145 | |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | ->join('employees', 'employee_group.employee_id', '=', 'employees.id') |
152 | 152 | ->whereIn('employees.id', $users) |
153 | 153 | ->whereIn('meetings.id', $meetings) |
154 | - ->where('groups.company_id','=', $this->id) //this is not needed |
|
155 | - ->where('employees.company_id','=', $this->id) //this is not needed |
|
154 | + ->where('groups.company_id', '=', $this->id) //this is not needed |
|
155 | + ->where('employees.company_id', '=', $this->id) //this is not needed |
|
156 | 156 | ->select('employees.id as employee_id', 'meetings.id as meeting_id') |
157 | 157 | ->get(); |
158 | 158 | } |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | { |
77 | 77 | $path = new Path(tempnam(sys_get_temp_dir(), 'OPT')); //TODO check the return in case of errors this return false on failure |
78 | 78 | unlink($path->getPath()); //remove file to create a dir |
79 | - if(file_exists($path->getPath())) |
|
79 | + if (file_exists($path->getPath())) |
|
80 | 80 | throw new OptimiseException('problem during creation of tmp dir (the directory already exists)'); |
81 | - if(!@mkdir($path->getPath())) |
|
82 | - throw new OptimiseException('problem during creation of tmp dir (mkdir problem)');; |
|
83 | - if(! is_dir($path->getPath())) |
|
81 | + if (!@mkdir($path->getPath())) |
|
82 | + throw new OptimiseException('problem during creation of tmp dir (mkdir problem)'); ; |
|
83 | + if (!is_dir($path->getPath())) |
|
84 | 84 | throw new OptimiseException('problem during creation of tmp dir (it is not possible to create directory)'); |
85 | 85 | return $path; |
86 | 86 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @return bool |
92 | 92 | */ |
93 | 93 | private static function delTree($dir) { |
94 | - $files = array_diff(scandir($dir), array('.','..')); |
|
94 | + $files = array_diff(scandir($dir), array('.', '..')); |
|
95 | 95 | foreach ($files as $file) { |
96 | 96 | (is_dir("$dir/$file")) ? delTree("$dir/$file") : unlink("$dir/$file"); |
97 | 97 | } |
@@ -48,8 +48,9 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function __destruct() |
50 | 50 | { |
51 | - if ($this->path && is_dir($this->path) && !self::delTree($this->path)) |
|
52 | - throw new OptimiseException('problems during removing of path directory'); |
|
51 | + if ($this->path && is_dir($this->path) && !self::delTree($this->path)) { |
|
52 | + throw new OptimiseException('problems during removing of path directory'); |
|
53 | + } |
|
53 | 54 | } |
54 | 55 | |
55 | 56 | /** |
@@ -76,12 +77,16 @@ discard block |
||
76 | 77 | { |
77 | 78 | $path = new Path(tempnam(sys_get_temp_dir(), 'OPT')); //TODO check the return in case of errors this return false on failure |
78 | 79 | unlink($path->getPath()); //remove file to create a dir |
79 | - if(file_exists($path->getPath())) |
|
80 | - throw new OptimiseException('problem during creation of tmp dir (the directory already exists)'); |
|
81 | - if(!@mkdir($path->getPath())) |
|
82 | - throw new OptimiseException('problem during creation of tmp dir (mkdir problem)');; |
|
83 | - if(! is_dir($path->getPath())) |
|
84 | - throw new OptimiseException('problem during creation of tmp dir (it is not possible to create directory)'); |
|
80 | + if(file_exists($path->getPath())) { |
|
81 | + throw new OptimiseException('problem during creation of tmp dir (the directory already exists)'); |
|
82 | + } |
|
83 | + if(!@mkdir($path->getPath())) { |
|
84 | + throw new OptimiseException('problem during creation of tmp dir (mkdir problem)'); |
|
85 | + } |
|
86 | + ; |
|
87 | + if(! is_dir($path->getPath())) { |
|
88 | + throw new OptimiseException('problem during creation of tmp dir (it is not possible to create directory)'); |
|
89 | + } |
|
85 | 90 | return $path; |
86 | 91 | } |
87 | 92 |
@@ -1,21 +1,21 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Created by PhpStorm. |
|
4 | - * User: Claudio Cardinale <[email protected]> |
|
5 | - * Date: 24/12/15 |
|
6 | - * Time: 22.53 |
|
7 | - * This program is free software; you can redistribute it and/or |
|
8 | - * modify it under the terms of the GNU General Public License |
|
9 | - * as published by the Free Software Foundation; either version 2 |
|
10 | - * of the License, or (at your option) any later version. |
|
11 | - * This program is distributed in the hope that it will be useful, |
|
12 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 | - * GNU General Public License for more details. |
|
15 | - * You should have received a copy of the GNU General Public License |
|
16 | - * along with this program; if not, write to the Free Software |
|
17 | - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
18 | - */ |
|
3 | + * Created by PhpStorm. |
|
4 | + * User: Claudio Cardinale <[email protected]> |
|
5 | + * Date: 24/12/15 |
|
6 | + * Time: 22.53 |
|
7 | + * This program is free software; you can redistribute it and/or |
|
8 | + * modify it under the terms of the GNU General Public License |
|
9 | + * as published by the Free Software Foundation; either version 2 |
|
10 | + * of the License, or (at your option) any later version. |
|
11 | + * This program is distributed in the hope that it will be useful, |
|
12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 | + * GNU General Public License for more details. |
|
15 | + * You should have received a copy of the GNU General Public License |
|
16 | + * along with this program; if not, write to the Free Software |
|
17 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
18 | + */ |
|
19 | 19 | |
20 | 20 | namespace plunner\Http\Middleware; |
21 | 21 |
@@ -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 |
@@ -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 | } |
@@ -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 | } |
@@ -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 | { |
@@ -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 |