@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Illuminate\Http\Request; |
| 6 | 6 | |
| 7 | -use plunner\Http\Requests; |
|
| 8 | 7 | use plunner\Http\Controllers\Controller; |
| 9 | 8 | |
| 10 | 9 | class GroupsController extends Controller |
@@ -13,8 +13,8 @@ discard block |
||
| 13 | 13 | { |
| 14 | 14 | public function __construct() |
| 15 | 15 | { |
| 16 | - config(['auth.model' => \plunner\Planner::class]); |
|
| 17 | - config(['jwt.user' => \plunner\Planner::class]); |
|
| 16 | + config([ 'auth.model' => \plunner\Planner::class ]); |
|
| 17 | + config([ 'jwt.user' => \plunner\Planner::class ]); |
|
| 18 | 18 | $this->middleware('jwt.authandrefresh:mode-en'); |
| 19 | 19 | } |
| 20 | 20 | |
@@ -32,10 +32,10 @@ discard block |
||
| 32 | 32 | $this->authorize($group); |
| 33 | 33 | $meetings = $group->meetings(); |
| 34 | 34 | if ($request->query('current')) |
| 35 | - $meetings->where(function ($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 36 | - $query->where('start_time', '=', NULL);//to be planned |
|
| 35 | + $meetings->where(function($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 36 | + $query->where('start_time', '=', NULL); //to be planned |
|
| 37 | 37 | //datetime to consider timezone, don't use mysql NOW() |
| 38 | - $query->orWhere('start_time', '>=', new \DateTime());//planned |
|
| 38 | + $query->orWhere('start_time', '>=', new \DateTime()); //planned |
|
| 39 | 39 | }); |
| 40 | 40 | |
| 41 | 41 | return $meetings->get(); |
@@ -31,9 +31,11 @@ |
||
| 31 | 31 | $group = Group::findOrFail($groupId); |
| 32 | 32 | $this->authorize($group); |
| 33 | 33 | $meetings = $group->meetings(); |
| 34 | - if ($request->query('current')) |
|
| 35 | - $meetings->where(function ($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 36 | - $query->where('start_time', '=', NULL);//to be planned |
|
| 34 | + if ($request->query('current')) { |
|
| 35 | + $meetings->where(function ($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 36 | + $query->where('start_time', '=', NULL); |
|
| 37 | + } |
|
| 38 | + //to be planned |
|
| 37 | 39 | //datetime to consider timezone, don't use mysql NOW() |
| 38 | 40 | $query->orWhere('start_time', '>=', new \DateTime());//planned |
| 39 | 41 | }); |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | { |
| 13 | 13 | public function __construct() |
| 14 | 14 | { |
| 15 | - config(['auth.model' => Planner::class]); |
|
| 16 | - config(['jwt.user' => Planner::class]); |
|
| 15 | + config([ 'auth.model' => Planner::class ]); |
|
| 16 | + config([ 'jwt.user' => Planner::class ]); |
|
| 17 | 17 | $this->middleware('jwt.authandrefresh:mode-en'); |
| 18 | 18 | } |
| 19 | 19 | |
@@ -32,16 +32,16 @@ discard block |
||
| 32 | 32 | $planner = \Auth::user(); |
| 33 | 33 | $groups = $planner->groupsManaged(); |
| 34 | 34 | if ($request->query('current')) |
| 35 | - $groups->with(['meetings' => function ($query) { |
|
| 36 | - $query->where(function ($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 37 | - $query->where('start_time', '=', NULL);//to be planned |
|
| 35 | + $groups->with([ 'meetings' => function($query) { |
|
| 36 | + $query->where(function($query) { //parenthesis for conditions ...(C1 OR C2)... |
|
| 37 | + $query->where('start_time', '=', NULL); //to be planned |
|
| 38 | 38 | //datetime to consider timezone, don't use mysql NOW() |
| 39 | - $query->orWhere('start_time', '>=', new \DateTime());//planned |
|
| 39 | + $query->orWhere('start_time', '>=', new \DateTime()); //planned |
|
| 40 | 40 | }); |
| 41 | - }]); |
|
| 41 | + } ]); |
|
| 42 | 42 | else |
| 43 | 43 | $groups->with('meetings'); |
| 44 | - return $groups->get();//both planed and to be planned |
|
| 44 | + return $groups->get(); //both planed and to be planned |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -31,16 +31,19 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | $planner = \Auth::user(); |
| 33 | 33 | $groups = $planner->groupsManaged(); |
| 34 | - if ($request->query('current')) |
|
| 35 | - $groups->with(['meetings' => function ($query) { |
|
| 34 | + if ($request->query('current')) { |
|
| 35 | + $groups->with(['meetings' => function ($query) { |
|
| 36 | 36 | $query->where(function ($query) { //parenthesis for conditions ...(C1 OR C2)... |
| 37 | - $query->where('start_time', '=', NULL);//to be planned |
|
| 37 | + $query->where('start_time', '=', NULL); |
|
| 38 | + } |
|
| 39 | + //to be planned |
|
| 38 | 40 | //datetime to consider timezone, don't use mysql NOW() |
| 39 | 41 | $query->orWhere('start_time', '>=', new \DateTime());//planned |
| 40 | 42 | }); |
| 41 | 43 | }]); |
| 42 | - else |
|
| 43 | - $groups->with('meetings'); |
|
| 44 | + else { |
|
| 45 | + $groups->with('meetings'); |
|
| 46 | + } |
|
| 44 | 47 | return $groups->get();//both planed and to be planned |
| 45 | 48 | } |
| 46 | 49 | |