first commit
Some checks failed
Build / run (push) Has been cancelled

This commit is contained in:
maher
2025-10-29 11:42:25 +01:00
commit 703f50a09d
4595 changed files with 385164 additions and 0 deletions

View File

@@ -0,0 +1,113 @@
<?php
namespace App\Services\Admin;
use App\Models\Review;
use App\Models\Title;
use App\Models\User;
use App\Models\VideoPlay;
use Common\Admin\Analytics\Actions\GetAnalyticsHeaderDataAction;
use Common\Comments\Comment;
use Common\Database\Metrics\ValueMetric;
class GetAnalyticsHeaderData implements GetAnalyticsHeaderDataAction
{
public function execute(array $params): array
{
return [
array_merge(
[
'icon' => [
[
'tag' => 'path',
'attr' => [
'd' =>
'M9 13.75c-2.34 0-7 1.17-7 3.5V19h14v-1.75c0-2.33-4.66-3.5-7-3.5zM4.34 17c.84-.58 2.87-1.25 4.66-1.25s3.82.67 4.66 1.25H4.34zM9 12c1.93 0 3.5-1.57 3.5-3.5S10.93 5 9 5 5.5 6.57 5.5 8.5 7.07 12 9 12zm0-5c.83 0 1.5.67 1.5 1.5S9.83 10 9 10s-1.5-.67-1.5-1.5S8.17 7 9 7zm7.04 6.81c1.16.84 1.96 1.96 1.96 3.44V19h4v-1.75c0-2.02-3.5-3.17-5.96-3.44zM15 12c1.93 0 3.5-1.57 3.5-3.5S16.93 5 15 5c-.54 0-1.04.13-1.5.35.63.89 1 1.98 1 3.15s-.37 2.26-1 3.15c.46.22.96.35 1.5.35z',
],
],
],
'name' => __('New users'),
],
(new ValueMetric(
User::query(),
dateRange: $params['dateRange'],
))->count(),
),
array_merge(
[
'icon' => [
[
'tag' => 'path',
'attr' => [
'd' =>
'M4 6.47 5.76 10H20v8H4V6.47M22 4h-4l2 4h-3l-2-4h-2l2 4h-3l-2-4H8l2 4H7L5 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4z',
],
],
],
'name' => __('New titles'),
],
(new ValueMetric(
Title::query(),
dateRange: $params['dateRange'],
))->count(),
),
array_merge(
[
'icon' => [
[
'tag' => 'path',
'attr' => [
'd' =>
'M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27z',
],
],
],
'name' => __('New ratings'),
],
(new ValueMetric(
Review::query(),
dateRange: $params['dateRange'],
))->count(),
),
array_merge(
[
'icon' => [
[
'tag' => 'path',
'attr' => [
'd' =>
'M10 8.64 15.27 12 10 15.36V8.64M8 5v14l11-7L8 5z',
],
],
],
'name' => __('Video plays'),
],
(new ValueMetric(
VideoPlay::query(),
dateRange: $params['dateRange'],
))->count(),
),
array_merge(
[
'icon' => [
[
'tag' => 'path',
'attr' => [
'd' =>
'M4 4h16v12H5.17L4 17.17V4m0-2c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2H4zm2 10h8v2H6v-2zm0-3h12v2H6V9zm0-3h12v2H6V6z',
],
],
],
'name' => __('New comments'),
],
(new ValueMetric(
Comment::query(),
dateRange: $params['dateRange'],
))->count(),
),
];
}
}