star-cloud/app/Models/System/UiElement.php
terrylee a0c2ab3207 feat(app-ui): APP UI元素設定 Phase 1 — 後台三頁(元素/組合/機台綁定)+ B014 UISet 下發
- ui_elements/ui_bundles/ui_bundle_items 三表 + Models(TenantScoped)
- config/ui_parts.php 部位定義(Phase 1 啟用 A1/A2/A3 滿版)
- UiElementController 三頁 CRUD + 圖片上傳(ImageHandler storeAsWebp)
- 機台綁定存 machines.settings['ui_bundle_id']
- B014 getSettings 新增 UISet(部位→絕對圖URL,mirror B005)
- 解除 sidebar APP管理 註解 + can:menu.app + 權限白名單
- zh_TW/en 翻譯

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-17 11:06:43 +08:00

47 lines
933 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Models\System;
use App\Traits\TenantScoped;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class UiElement extends Model
{
use HasFactory, TenantScoped;
protected $fillable = [
'company_id',
'part_key',
'name',
'type',
'image_url',
'is_active',
];
protected $casts = [
'is_active' => 'boolean',
];
/**
* 部位定義(來自 config/ui_parts.php
*/
public function getPartAttribute(): ?array
{
return config("ui_parts.parts.{$this->part_key}");
}
/**
* 部位顯示名稱。
*/
public function getPartLabelAttribute(): string
{
return config("ui_parts.parts.{$this->part_key}.label", $this->part_key);
}
public function scopeActive($query)
{
return $query->where('is_active', true);
}
}