Files
SkinbaseNova/app/Models/AdsenseDailyStat.php
klevze ce0f278bac Add a read-only Google AdSense analytics module for admins.
Connect AdSense over OAuth, sync entities and daily reports locally, and show placement performance in the admin panel without calling the Management API from public pages.
2026-09-20 14:49:48 +02:00

69 lines
1.8 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
final class AdsenseDailyStat extends Model
{
public const DIMENSION_TOTAL = 'total';
public const DIMENSION_AD_UNIT = 'ad_unit';
public const DIMENSION_CUSTOM_CHANNEL = 'custom_channel';
public const DIMENSION_PLATFORM = 'platform';
public const DIMENSION_COUNTRY = 'country';
public const TOTAL_DIMENSION_KEY = '__total__';
protected $fillable = [
'date',
'account_resource_name',
'dimension_type',
'dimension_key',
'dimension_label',
'currency_code',
'page_views',
'ad_requests',
'matched_ad_requests',
'impressions',
'clicks',
'estimated_earnings',
'page_views_ctr',
'page_views_rpm',
'ad_requests_coverage',
'ad_requests_ctr',
'ad_requests_rpm',
'impressions_ctr',
'impressions_rpm',
'cost_per_click',
'last_synced_at',
];
protected function casts(): array
{
return [
'date' => 'date',
'page_views' => 'integer',
'ad_requests' => 'integer',
'matched_ad_requests' => 'integer',
'impressions' => 'integer',
'clicks' => 'integer',
'estimated_earnings' => 'decimal:6',
'page_views_ctr' => 'decimal:8',
'page_views_rpm' => 'decimal:6',
'ad_requests_coverage' => 'decimal:8',
'ad_requests_ctr' => 'decimal:8',
'ad_requests_rpm' => 'decimal:6',
'impressions_ctr' => 'decimal:8',
'impressions_rpm' => 'decimal:6',
'cost_per_click' => 'decimal:6',
'last_synced_at' => 'datetime',
];
}
}