From 2b5a7c9b1b50b1e1987f0cf8660bc7f1a00b4b10 Mon Sep 17 00:00:00 2001 From: Amirmahdi Nourkazemi Date: Thu, 25 Jun 2026 10:07:42 +0330 Subject: [PATCH] feat: add btn text --- .../Controllers/AnnouncementController.php | 2 ++ app/Http/Controllers/AppVersionController.php | 2 ++ app/Models/Announcement.php | 2 +- app/Models/AppVersion.php | 2 +- ...text_to_announcements_and_app_versions.php | 30 +++++++++++++++++++ 5 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 database/migrations/2026_06_24_120000_add_button_text_to_announcements_and_app_versions.php diff --git a/app/Http/Controllers/AnnouncementController.php b/app/Http/Controllers/AnnouncementController.php index 6035e8f..0966959 100644 --- a/app/Http/Controllers/AnnouncementController.php +++ b/app/Http/Controllers/AnnouncementController.php @@ -36,6 +36,7 @@ public function store(Request $request) 'title' => 'required|string|max:255', 'description' => 'nullable|string', 'link' => 'nullable|string|max:500', + 'button_text' => 'nullable|string|max:255', 'start_date' => 'nullable|date', 'end_date' => 'nullable|date|after_or_equal:start_date', 'image_id' => 'nullable|exists:images,id', @@ -68,6 +69,7 @@ public function update(Request $request, $id) 'title' => 'sometimes|string|max:255', 'description' => 'nullable|string', 'link' => 'nullable|string|max:500', + 'button_text' => 'nullable|string|max:255', 'start_date' => 'nullable|date', 'end_date' => 'nullable|date|after_or_equal:start_date', 'image_id' => 'nullable|exists:images,id', diff --git a/app/Http/Controllers/AppVersionController.php b/app/Http/Controllers/AppVersionController.php index 85b7c8d..bab659a 100644 --- a/app/Http/Controllers/AppVersionController.php +++ b/app/Http/Controllers/AppVersionController.php @@ -34,6 +34,7 @@ public function store(Request $request) 'version_name' => 'required|string|max:255', 'version_code' => 'required|integer|min:0', 'link' => 'nullable|string|max:500', + 'button_text' => 'nullable|string|max:255', 'image_id' => 'nullable|exists:images,id', 'image' => 'nullable|file|extensions:jpg,jpeg,png,gif,webp,bmp,svg|max:8192', ]); @@ -66,6 +67,7 @@ public function update(Request $request, $id) 'version_name' => 'sometimes|string|max:255', 'version_code' => 'sometimes|integer|min:0', 'link' => 'nullable|string|max:500', + 'button_text' => 'nullable|string|max:255', 'image_id' => 'nullable|exists:images,id', 'image' => 'nullable|file|extensions:jpg,jpeg,png,gif,webp,bmp,svg|max:8192', ]); diff --git a/app/Models/Announcement.php b/app/Models/Announcement.php index 0816895..bf2c531 100644 --- a/app/Models/Announcement.php +++ b/app/Models/Announcement.php @@ -8,7 +8,7 @@ class Announcement extends Model { protected $fillable = [ - 'image_id', 'title', 'description', 'link', 'start_date', 'end_date', + 'image_id', 'title', 'description', 'link', 'button_text', 'start_date', 'end_date', ]; protected $casts = [ diff --git a/app/Models/AppVersion.php b/app/Models/AppVersion.php index 60c3d3d..aa04b8d 100644 --- a/app/Models/AppVersion.php +++ b/app/Models/AppVersion.php @@ -8,7 +8,7 @@ class AppVersion extends Model { protected $fillable = [ - 'image_id', 'title', 'description', 'version_name', 'version_code', 'link', + 'image_id', 'title', 'description', 'version_name', 'version_code', 'link', 'button_text', ]; protected $casts = [ diff --git a/database/migrations/2026_06_24_120000_add_button_text_to_announcements_and_app_versions.php b/database/migrations/2026_06_24_120000_add_button_text_to_announcements_and_app_versions.php new file mode 100644 index 0000000..db348ba --- /dev/null +++ b/database/migrations/2026_06_24_120000_add_button_text_to_announcements_and_app_versions.php @@ -0,0 +1,30 @@ +string('button_text')->nullable()->after('link'); + }); + + Schema::table('app_versions', function (Blueprint $table) { + $table->string('button_text')->nullable()->after('link'); + }); + } + + public function down(): void + { + Schema::table('announcements', function (Blueprint $table) { + $table->dropColumn('button_text'); + }); + + Schema::table('app_versions', function (Blueprint $table) { + $table->dropColumn('button_text'); + }); + } +};