Files
star-cloud/app/Models/System/Advertisement.php
sky121113 54d62c5378
All checks were successful
star-cloud-deploy-demo / deploy-demo (push) Successful in 1m7s
[FEAT] 實作機台廣告管理模組與多語系支援
1. 新增廣告管理列表與機台配置介面,包含多語系 (zh_TW, en, ja) 與完整 CRUD
2. 實作基於 Alpine 的廣告素材預覽輪播功能
3. 優化廣告素材下拉選單,強制綁定所屬公司以達成多租戶資料隔離
4. 重構廣告配置中廣告影片的縮圖渲染邏輯,移除 <video> 標籤以大幅提升頁面載入速度與節省頻寬
5. 放寬個人檔案頭像上傳限制,支援 WebP 格式
2026-03-31 13:30:41 +08:00

52 lines
1.0 KiB
PHP

<?php
namespace App\Models\System;
use App\Models\Machine\MachineAdvertisement;
use App\Traits\TenantScoped;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Advertisement extends Model
{
use HasFactory, TenantScoped;
protected $fillable = [
'company_id',
'name',
'type',
'duration',
'url',
'is_active',
];
protected $casts = [
'duration' => 'integer',
'is_active' => 'boolean',
];
/**
* Get the machine assignments for this advertisement.
*/
public function machineAdvertisements()
{
return $this->hasMany(MachineAdvertisement::class);
}
/**
* Get the company that owns the advertisement.
*/
public function company()
{
return $this->belongsTo(Company::class);
}
/**
* Scope a query to only include active advertisements.
*/
public function scopeActive($query)
{
return $query->where('is_active', true);
}
}