User Statistik

This commit is contained in:
Kevin Adametz 2026-05-18 17:23:28 +02:00
parent 70240d2b6a
commit 53bdba33cd
24 changed files with 2633 additions and 9 deletions

View file

@ -0,0 +1,29 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class BackofficeStatisticsSnapshot extends Model
{
protected $table = 'backoffice_statistics_snapshots';
protected $fillable = [
'user_id',
'year',
'month',
'payload',
'calculated_at',
];
protected function casts(): array
{
return [
'user_id' => 'int',
'year' => 'int',
'month' => 'int',
'payload' => 'array',
'calculated_at' => 'datetime',
];
}
}

View file

@ -167,6 +167,8 @@ class ShoppingOrder extends Model
'api_notice',
'api_status',
'mode',
'customer_order_source',
'customer_order_source_comment',
'shipped',
'tracking',
];
@ -180,6 +182,29 @@ class ShoppingOrder extends Model
'points' => 'float',
];
public const CUSTOMER_ORDER_SOURCE_OPTIONS = [
'recommendation' => 'Empfehlung',
'social_media' => 'Social Media',
'search_engine' => 'Google / Suchmaschine',
'event' => 'Event / Messe',
'consultant_link' => 'Berater-Link',
'returning_customer' => 'Wiederbesteller',
'other' => 'Sonstiges',
];
/**
* @return array<string, string>
*/
public static function customerOrderSourceOptions(): array
{
return self::CUSTOMER_ORDER_SOURCE_OPTIONS;
}
public function getCustomerOrderSourceLabel(): string
{
return self::CUSTOMER_ORDER_SOURCE_OPTIONS[$this->customer_order_source] ?? '';
}
public static $shippedTypes = [
0 => 'open',
1 => 'in_process',