From 3b5b2e3b09d1a843a661d2bfd24810ede336c709 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Thu, 8 Jul 2021 13:53:38 +0200 Subject: [PATCH 1/4] Migration: 2021_07_08_134818_add_description_column_to_recipes_table.php --- ...dd_description_column_to_recipes_table.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 database/migrations/2021_07_08_134818_add_description_column_to_recipes_table.php diff --git a/database/migrations/2021_07_08_134818_add_description_column_to_recipes_table.php b/database/migrations/2021_07_08_134818_add_description_column_to_recipes_table.php new file mode 100644 index 0000000..ac7d643 --- /dev/null +++ b/database/migrations/2021_07_08_134818_add_description_column_to_recipes_table.php @@ -0,0 +1,20 @@ +text('description')->nullable(); + }); + } +} From b06cf18f51ca439bec1aefe4b163968f5236944c Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Thu, 8 Jul 2021 13:54:10 +0200 Subject: [PATCH 2/4] app/Models/Recipe.php: Add description to fillable array. --- app/Models/Recipe.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Models/Recipe.php b/app/Models/Recipe.php index 5352afb..013ec1e 100644 --- a/app/Models/Recipe.php +++ b/app/Models/Recipe.php @@ -33,7 +33,8 @@ class Recipe extends Model 'profession_id', 'category_id', 'item_id', - 'spell_id' + 'spell_id', + 'description' ]; /** From 389a22ff38b9bb43814782c91be388294986657f Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Thu, 8 Jul 2021 14:08:31 +0200 Subject: [PATCH 3/4] app/Jobs/ImportProfession.php: Import description. --- app/Jobs/ImportProfession.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/Jobs/ImportProfession.php b/app/Jobs/ImportProfession.php index 05f33d1..cf923a1 100644 --- a/app/Jobs/ImportProfession.php +++ b/app/Jobs/ImportProfession.php @@ -173,12 +173,20 @@ class ImportProfession implements ShouldQueue $recipe = $profession->recipes()->create([ 'item_id' => $crafted ? $crafted->id : null, 'spell_id' => $spell->id, - 'category_id' => $category->id + 'category_id' => $category->id, + 'description' => isset($data->description) ? $data->description : null ]); } - // Update with crafted item :) - else if ($crafted) { - $recipe->craft()->associate($crafted); + // Update record + else { + + if ($crafted) { + $recipe->craft()->associate($crafted); + } + + if ($recipe->description === NULL && isset($data->description)) { + $recipe->description = $data->description; + } } // Insert/Update Reagents From 8ec20f02e44b4eb59c159d0288fe0b210fc5f260 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Thu, 8 Jul 2021 14:10:04 +0200 Subject: [PATCH 4/4] resources/views/recipe/show.blade.php: Show description --- resources/views/recipe/show.blade.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/views/recipe/show.blade.php b/resources/views/recipe/show.blade.php index 5baaec8..dde0630 100644 --- a/resources/views/recipe/show.blade.php +++ b/resources/views/recipe/show.blade.php @@ -9,6 +9,10 @@
+ @if ($recipe->description) +

{{ $recipe->description }}

+ @endif + @if ($recipe->craft)