diff --git a/app/Livewire/Project/Edit.php b/app/Livewire/Project/Edit.php index a2d73eb5f..eafc649cb 100644 --- a/app/Livewire/Project/Edit.php +++ b/app/Livewire/Project/Edit.php @@ -14,17 +14,25 @@ class Edit extends Component public ?string $description = null; + public ?string $color = null; + protected function rules(): array { return [ 'name' => ValidationPatterns::nameRules(), 'description' => ValidationPatterns::descriptionRules(), + 'color' => ['nullable', 'string', 'regex:/^#[0-9A-Fa-f]{6}$/'], ]; } protected function messages(): array { - return ValidationPatterns::combinedMessages(); + return array_merge( + ValidationPatterns::combinedMessages(), + [ + 'color.regex' => 'The color must be a valid hex color code (e.g., #FF5733).', + ] + ); } public function mount(string $project_uuid) @@ -44,10 +52,12 @@ class Edit extends Component $this->project->update([ 'name' => $this->name, 'description' => $this->description, + 'color' => $this->color, ]); } else { $this->name = $this->project->name; $this->description = $this->project->description; + $this->color = $this->project->color; } } diff --git a/database/migrations/2026_02_03_001245_add_color_to_projects_table.php b/database/migrations/2026_02_03_001245_add_color_to_projects_table.php new file mode 100644 index 000000000..6ab3c480b --- /dev/null +++ b/database/migrations/2026_02_03_001245_add_color_to_projects_table.php @@ -0,0 +1,32 @@ +string('color', 7)->nullable()->after('description'); + }); + } + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + if (Schema::hasColumn('projects', 'color')) { + Schema::table('projects', function (Blueprint $table) { + $table->dropColumn('color'); + }); + } + } +}; diff --git a/resources/views/livewire/dashboard.blade.php b/resources/views/livewire/dashboard.blade.php index a58ca0a00..c8c491ee9 100644 --- a/resources/views/livewire/dashboard.blade.php +++ b/resources/views/livewire/dashboard.blade.php @@ -35,7 +35,10 @@ @if ($projects->count() > 0)