Skip to content

Commit ec34590

Browse files
authored
Merge pull request #1158 from Lan2Play/dev
Replace morris with chart.js and readd charts + Dependency updates
2 parents d4aa893 + 80d2ab1 commit ec34590

13 files changed

+375
-246
lines changed

.github/workflows/test_and_build.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
password: ${{ secrets.DOCKERHUB_TOKEN }}
5050
- name: Build Linux Image
5151
if: ${{ github.event_name == 'pull_request' }}
52-
uses: docker/build-push-action@v6.13.0
52+
uses: docker/build-push-action@v6.14.0
5353
with:
5454
context: .
5555
file: ./Dockerfile
@@ -66,7 +66,7 @@ jobs:
6666
push: false
6767
- name: Build and push Linux Image
6868
if: ${{ startsWith(github.ref, 'refs/heads/main') && github.event_name == 'push' }}
69-
uses: docker/build-push-action@v6.13.0
69+
uses: docker/build-push-action@v6.14.0
7070
with:
7171
context: .
7272
file: ./Dockerfile
@@ -84,7 +84,7 @@ jobs:
8484
push: true
8585
- name: Build and push Linux legacy Image
8686
if: ${{ startsWith(github.ref, 'refs/heads/legacy') && github.event_name == 'push' }}
87-
uses: docker/build-push-action@v6.13.0
87+
uses: docker/build-push-action@v6.14.0
8888
with:
8989
context: .
9090
file: ./Dockerfile
@@ -101,7 +101,7 @@ jobs:
101101
push: true
102102
- name: Build and push Linux Image dev
103103
if: ${{ startsWith(github.ref, 'refs/heads/dev') && github.event_name == 'push' }}
104-
uses: docker/build-push-action@v6.13.0
104+
uses: docker/build-push-action@v6.14.0
105105
with:
106106
context: .
107107
file: ./Dockerfile

src/.phpstorm.meta.php

+123-123
Large diffs are not rendered by default.

src/_ide_helper.php

+61-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
/**
77
* A helper file for Laravel, to provide autocomplete information to your IDE
8-
* Generated for Laravel 11.42.1.
8+
* Generated for Laravel 11.43.2.
99
*
1010
* This file should not be included in your code, only analyzed by your IDE!
1111
*
@@ -11075,6 +11075,19 @@ public static function pushed($job, $callback = null)
1107511075
return $instance->pushed($job, $callback);
1107611076
}
1107711077

11078+
/**
11079+
* Get all of the raw pushes matching a truth-test callback.
11080+
*
11081+
* @param null|\Closure(string, ?string, array): bool $callback
11082+
* @return \Illuminate\Support\Collection<int, RawPushType>
11083+
* @static
11084+
*/
11085+
public static function pushedRaw($callback = null)
11086+
{
11087+
/** @var \Illuminate\Support\Testing\Fakes\QueueFake $instance */
11088+
return $instance->pushedRaw($callback);
11089+
}
11090+
1107811091
/**
1107911092
* Determine if there are any stored jobs for a given class.
1108011093
*
@@ -11231,6 +11244,18 @@ public static function pushedJobs()
1123111244
return $instance->pushedJobs();
1123211245
}
1123311246

11247+
/**
11248+
* Get the payloads that were pushed raw.
11249+
*
11250+
* @return list<RawPushType>
11251+
* @static
11252+
*/
11253+
public static function rawPushes()
11254+
{
11255+
/** @var \Illuminate\Support\Testing\Fakes\QueueFake $instance */
11256+
return $instance->rawPushes();
11257+
}
11258+
1123411259
/**
1123511260
* Specify if jobs should be serialized and restored when being "pushed" to the queue.
1123611261
*
@@ -14555,6 +14580,7 @@ public static function flushMacros()
1455514580
* @method static \Illuminate\Routing\RouteRegistrar whereUuid(array|string $parameters)
1455614581
* @method static \Illuminate\Routing\RouteRegistrar whereIn(array|string $parameters, array $values)
1455714582
* @method static \Illuminate\Routing\RouteRegistrar as(string $value)
14583+
* @method static \Illuminate\Routing\RouteRegistrar can(\UnitEnum|string $ability, array|string $models = [])
1455814584
* @method static \Illuminate\Routing\RouteRegistrar controller(string $controller)
1455914585
* @method static \Illuminate\Routing\RouteRegistrar domain(\BackedEnum|string $value)
1456014586
* @method static \Illuminate\Routing\RouteRegistrar middleware(array|string|null $middleware)
@@ -24591,6 +24617,22 @@ public static function find($id, $columns = [])
2459124617
return $instance->find($id, $columns);
2459224618
}
2459324619

24620+
/**
24621+
* Find a sole model by its primary key.
24622+
*
24623+
* @param mixed $id
24624+
* @param array|string $columns
24625+
* @return TModel
24626+
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException<TModel>
24627+
* @throws \Illuminate\Database\MultipleRecordsFoundException
24628+
* @static
24629+
*/
24630+
public static function findSole($id, $columns = [])
24631+
{
24632+
/** @var \Illuminate\Database\Eloquent\Builder $instance */
24633+
return $instance->findSole($id, $columns);
24634+
}
24635+
2459424636
/**
2459524637
* Find multiple models by their primary keys.
2459624638
*
@@ -25642,7 +25684,7 @@ public static function whereHas($relation, $callback = null, $operator = '>=', $
2564225684
/**
2564325685
* Add a relationship count / exists condition to the query with where clauses.
2564425686
*
25645-
* Also load the relationship with same condition.
25687+
* Also load the relationship with the same condition.
2564625688
*
2564725689
* @param string $relation
2564825690
* @param (\Closure(\Illuminate\Database\Eloquent\Builder<*>|\Illuminate\Database\Eloquent\Relations\Relation<*, *, *>): mixed)|null $callback
@@ -25793,7 +25835,7 @@ public static function whereHasMorph($relation, $types, $callback = null, $opera
2579325835
*
2579425836
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
2579525837
* @param \Illuminate\Database\Eloquent\Relations\MorphTo<TRelatedModel, *>|string $relation
25796-
* @param string|array<int, array> $types
25838+
* @param string|array<int, string> $types
2579725839
* @param (\Closure(\Illuminate\Database\Eloquent\Builder<TRelatedModel>, string): mixed)|null $callback
2579825840
* @param string $operator
2579925841
* @param int $count
@@ -25855,6 +25897,22 @@ public static function whereRelation($relation, $column, $operator = null, $valu
2585525897
return $instance->whereRelation($relation, $column, $operator, $value);
2585625898
}
2585725899

25900+
/**
25901+
* Add a basic where clause to a relationship query and eager-load the relationship with the same conditions.
25902+
*
25903+
* @param \Illuminate\Database\Eloquent\Relations\Relation<*, *, *>|string $relation
25904+
* @param \Closure|string|array|\Illuminate\Contracts\Database\Query\Expression $column
25905+
* @param mixed $operator
25906+
* @param mixed $value
25907+
* @return \Illuminate\Database\Eloquent\Builder<static>
25908+
* @static
25909+
*/
25910+
public static function withWhereRelation($relation, $column, $operator = null, $value = null)
25911+
{
25912+
/** @var \Illuminate\Database\Eloquent\Builder $instance */
25913+
return $instance->withWhereRelation($relation, $column, $operator, $value);
25914+
}
25915+
2585825916
/**
2585925917
* Add an "or where" clause to a relationship query.
2586025918
*

src/app/Http/Controllers/Admin/AdminController.php

+27-8
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,33 @@ public function index()
5959
}
6060
$userLoginMethodCount[$gateway] = $count;
6161
}
62-
$orderBreakdown = array();
63-
foreach (ShopOrder::where('created_at', '>=', Carbon::now()->subMonths(12)->month)->get() as $order) {
64-
$orderBreakdown[date_format($order->created_at, 'm')][] = $order;
65-
}
66-
$ticketBreakdown = array();
67-
foreach (EventParticipant::where('created_at', '>=', Carbon::now()->subMonths(12)->month)->get() as $participant) {
68-
$ticketBreakdown[date_format($participant->created_at, 'm')][] = $participant;
69-
}
62+
$orderBreakdown = collect(range(1, 12))
63+
->mapWithKeys(function ($month) {
64+
return [Carbon::now()->startOfYear()->addMonthsNoOverflow($month - 1)->format('F') => 0];
65+
})
66+
->merge(
67+
ShopOrder::where('created_at', '>=', Carbon::now()->subMonths(12))
68+
->get()
69+
->groupBy(function ($order) {
70+
return Carbon::parse($order->created_at)->format('F');
71+
})
72+
->map->count()
73+
)
74+
->all();
75+
$ticketBreakdown = collect(range(0, 11))
76+
->mapWithKeys(function ($month) {
77+
return [Carbon::now()->startOfYear()->addMonthsNoOverflow($month)->format('F') => 0];
78+
})
79+
->merge(
80+
EventParticipant::where('created_at', '>=', Carbon::now()->subMonths(12))
81+
->get()
82+
->groupBy(function ($participant) {
83+
return Carbon::parse($participant->created_at)->format('F');
84+
})
85+
->map->count()
86+
)
87+
->all();
88+
7089
return view('admin.index')
7190
->with('user', $user)
7291
->with('events', $events)

src/app/Http/Controllers/Admin/Events/TicketsController.php

+17-1
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,27 @@ public function index(Event $event)
4242
return $user->getStaffTickets($event->id)->count();
4343
});
4444

45+
$purchaseBreakDown = $event->tickets()->withCount('participants')->get()->map(function ($ticket) {
46+
return [
47+
'name' => $ticket->name,
48+
'count' => $ticket->participants_count,
49+
];
50+
})->toArray();
51+
52+
$incomeBreakDown = $event->tickets()->withCount('participants')->get()->map(function ($ticket) {
53+
return [
54+
'name' => $ticket->name,
55+
'income' => $ticket->price * $ticket->participants_count,
56+
];
57+
})->toArray();
58+
4559
return view('admin.events.tickets.index')
4660
->with('event', $event)
4761
->with('totalFreeTickets', $totalFreeTickets)
4862
->with('totalStaffTickets', $totalStaffTickets)
49-
->with('users', $users);
63+
->with('users', $users)
64+
->with('purchaseBreakdownData', $purchaseBreakDown)
65+
->with('incomeBreakdownData', $incomeBreakDown);
5066
}
5167

5268
/**

src/composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"type": "project",
3636
"require": {
3737
"php": "8.4.*",
38-
"laravel/framework": "11.42.1",
38+
"laravel/framework": "11.43.2",
3939
"laravelcollective/html": "dev-6x",
4040
"laravel/legacy-factories": "1.4.1",
4141
"webonyx/graphql-php": "15.19.1",
@@ -74,7 +74,7 @@
7474
"require-dev": {
7575
"mockery/mockery": "1.6.12",
7676
"fakerphp/faker": "1.24.1",
77-
"phpunit/phpunit": "12.0.2",
77+
"phpunit/phpunit": "12.0.3",
7878
"kitloong/laravel-migrations-generator": "7.0.7",
7979
"symfony/css-selector": "7.2.0",
8080
"symfony/dom-crawler": "7.2.3",

src/composer.lock

+18-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)