*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'name' => $this->name, 'title' => $this->title, 'text' => $this->text, // 照片 - 完整路徑 'portrait' => $this->portrait ? (filter_var($this->portrait, FILTER_VALIDATE_URL) ? $this->portrait : asset('uploads/' . ltrim($this->portrait, '/'))) : null, // positions - 將 \r\n 換行轉為陣列 'positions' => $this->positions_array, 'member_type' => $this->member_type, 'sort' => $this->sort, 'status' => $this->status, 'created_at' => $this->created_at->toISOString(), 'updated_at' => $this->updated_at->toISOString(), ]; } }