@extends('layouts.app') @section('title', ($req ? '安裝申請草稿 #' . $req->id : '新增安裝申請') . ' - ' . $project->name) @php $me = auth()->user(); $oldPm = (int) old('pm_id', $pms->first()->id ?? 0); // 編輯草稿時以草稿內容預填;驗證失敗返回時以 old() 為準 $pk = collect($req?->packages ?? []); $std = $pk->where('key', '!=', 'other'); $savedExt = $req?->php_extensions ?? []; $oldPkg = old('pkg', $std->pluck('key')->all()); $oldVer = old('ver', $std->pluck('version', 'key')->all()); $oldExt = old('php_ext', array_values(array_intersect($savedExt, $phpExtensions))); $oldExtOther = old('php_ext_other', implode(', ', array_diff($savedExt, $phpExtensions))); $oldOther = array_values(array_filter(old('other', $pk->where('key', 'other')->values()->all()), fn ($o) => trim($o['name'] ?? '') !== '')) ?: [['name' => '', 'version' => '']]; $oldCollab = array_map('intval', old('collaborators', $req ? $req->collaborators->pluck('id')->all() : [])); $isCollab = $req && !$isOwner; $unconfirmed = $req ? $req->collaborators->whereNull('pivot.confirmed_at')->pluck('name')->all() : []; $verHints = [ 'apache' => ['2.4'], 'php' => ['8.4', '8.3', '8.2', '8.1', '7.4'], 'mysql' => ['8.4', '8.0', '5.7'], 'node' => ['22 LTS', '20 LTS', '18 LTS'], 'java' => ['21', '17', '11', '8'], 'python' => ['3.12', '3.11', '3.10'], ]; @endphp @push('styles') @endpush @section('content') @include('projects._nav')