1. 新增 `ApkVersion` Model 與對應的資料表遷移檔 (`create_apk_versions_table`),用以記錄 APK 版本、代碼、風味、更新說明、下載連結與更新模式等欄位。 2. 實作 `ApkVersionController` 控制器,提供 APK 版本之 CRUD(列表、建立、刪除)以及 OTA 推送功能。 3. 移除了 `SpecialPermissionController` 中舊有的 `apkVersions` 占位路由方法,並於 `routes/web.php` 的基本設定 (`basic-settings`) 下新增完整的 APK 版本管理與推送路由。 4. 於 `RoleSeeder.php` 角色種子資料中為 Super Admin 與系統管理員新增 `menu.basic.apk-versions` 權限。 5. 於 `sidebar-menu.blade.php` 基本設定選單中,加入「APK版本管理」之子選單選項,並以對應權限進行防護。 6. 實作 APK 版本列表與上傳頁面 Blade 視圖,採用 Preline UI 與 Alpine.js 提供極簡奢華風的 UI 互動,包含檔案上傳拖曳與 OTA 設備選擇部署彈窗。 7. 更新繁體中文語系檔 `zh_TW.json`,對齊所有新增之 OTA 韌體與版本管理翻譯字詞。
32 lines
604 B
PHP
32 lines
604 B
PHP
<?php
|
|
|
|
namespace App\Models\Machine;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
class ApkVersion extends Model
|
|
{
|
|
protected $fillable = [
|
|
'version_name',
|
|
'version_code',
|
|
'flavor',
|
|
'file_path',
|
|
'download_url',
|
|
'release_notes',
|
|
'is_forced',
|
|
];
|
|
|
|
protected $casts = [
|
|
'is_forced' => 'boolean',
|
|
];
|
|
|
|
/**
|
|
* 取得最終下載 URL
|
|
*/
|
|
public function getUrlAttribute(): string
|
|
{
|
|
return $this->download_url ?: Storage::disk('public')->url($this->file_path);
|
|
}
|
|
}
|