Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
ShortcutTrait | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 1 |
getShortcutByUsers | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
12 |
1 | <?php |
2 | |
3 | namespace App\Traits\AccountCenter\Reporting; |
4 | |
5 | use App\Http\Models\Shortcut; |
6 | use MongoDB\BSON\UTCDateTime; |
7 | |
8 | trait ShortcutTrait |
9 | { |
10 | public function getShortcutByUsers($userIds, $userDefined, $fromDate, $toDate) |
11 | { |
12 | $query = Shortcut::withoutGlobalScopes()->whereIn("user_id", $userIds) |
13 | ->where('user_defined', $userDefined); |
14 | |
15 | if ($fromDate && $toDate) { |
16 | $query = $query->whereBetween("created_at", [ |
17 | new UTCDateTime($fromDate->getTimestamp() * 1000), |
18 | new UTCDateTime($toDate->getTimestamp() * 1000), |
19 | ]); |
20 | } |
21 | |
22 | return $query->get(); |
23 | } |
24 | } |