'array', 'default_values' => 'array', 'is_default' => 'boolean', ]; public function category() { return $this->belongsTo(DocumentCategory::class); } public function creator() { return $this->belongsTo(User::class, 'created_by'); } public function generateDocument($values = []) { $content = $this->template_content; // Merge default values with provided values $allValues = array_merge($this->default_values ?? [], $values); // Replace placeholders foreach ($allValues as $key => $value) { $content = str_replace('{{' . $key . '}}', $value, $content); } return $content; } public function getPlaceholderList() { return $this->placeholders ?? []; } }