From d22fb3521bc9ad72705759698e2cd672393bcb54 Mon Sep 17 00:00:00 2001 From: Mazarin Date: Mon, 19 Feb 2024 08:15:53 -0500 Subject: [PATCH] feat: add gender for lists (#51) --- app/Http/Controllers/ListController.php | 1 + app/Models/NameList.php | 1 + app/Services/CreateList.php | 2 ++ database/factories/NameListFactory.php | 1 + ...24_02_19_125208_update_user_list_table.php | 15 ++++++++ resources/views/user/lists/new.blade.php | 36 ++++++++++++++++++- 6 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 database/migrations/2024_02_19_125208_update_user_list_table.php diff --git a/app/Http/Controllers/ListController.php b/app/Http/Controllers/ListController.php index dcb5530..90097cf 100644 --- a/app/Http/Controllers/ListController.php +++ b/app/Http/Controllers/ListController.php @@ -28,6 +28,7 @@ public function store(Request $request): RedirectResponse description: $request->input('description'), isPublic: false, canBeModified: true, + gender: $request->input('gender'), ))->execute(); Cache::forget('route-list-' . $list->id); diff --git a/app/Models/NameList.php b/app/Models/NameList.php index cdb3dfb..45f78d3 100644 --- a/app/Models/NameList.php +++ b/app/Models/NameList.php @@ -26,6 +26,7 @@ class NameList extends Model 'is_public', 'can_be_modified', 'is_list_of_favorites', + 'gender', ]; protected $casts = [ diff --git a/app/Services/CreateList.php b/app/Services/CreateList.php index 3baa266..e917363 100644 --- a/app/Services/CreateList.php +++ b/app/Services/CreateList.php @@ -14,6 +14,7 @@ public function __construct( public ?string $description, public bool $isPublic, public bool $canBeModified, + public string $gender, ) { } @@ -33,6 +34,7 @@ private function createList(): void 'description' => $this->description, 'is_public' => $this->isPublic, 'can_be_modified' => $this->canBeModified, + 'gender' => $this->gender, ]); } } diff --git a/database/factories/NameListFactory.php b/database/factories/NameListFactory.php index 6f9de16..9e69e06 100644 --- a/database/factories/NameListFactory.php +++ b/database/factories/NameListFactory.php @@ -25,6 +25,7 @@ public function definition(): array 'can_be_modified' => fake()->boolean, 'is_list_of_favorites' => fake()->boolean, 'uuid' => fake()->uuid, + 'gender' => fake()->text(20), ]; } } diff --git a/database/migrations/2024_02_19_125208_update_user_list_table.php b/database/migrations/2024_02_19_125208_update_user_list_table.php new file mode 100644 index 0000000..954d177 --- /dev/null +++ b/database/migrations/2024_02_19_125208_update_user_list_table.php @@ -0,0 +1,15 @@ +string('gender')->after('is_list_of_favorites')->nullable(); + }); + } +}; diff --git a/resources/views/user/lists/new.blade.php b/resources/views/user/lists/new.blade.php index 3354a12..d10a9be 100644 --- a/resources/views/user/lists/new.blade.php +++ b/resources/views/user/lists/new.blade.php @@ -43,7 +43,7 @@ -
+
@@ -56,6 +56,40 @@
+ +
+

{{ __('Genre de la liste') }}

+
+
+
+ +
+
+ +

{{ __('La liste contient des prénoms de garçons.') }}

+
+
+
+
+ +
+
+ +

{{ __('La liste contient des prénoms de filles.') }}

+
+
+
+
+ +
+
+ +

{{ __('La liste contient des prénoms mixtes.') }}

+
+
+
+
+
{{ __('Back') }}