From 48035c2fc651531515697cf36870e2e0e29eb005 Mon Sep 17 00:00:00 2001 From: Tommaso Bailetti Date: Tue, 13 Dec 2022 13:05:03 +0100 Subject: [PATCH] feat: added data to installation --- app/Models/Installation.php | 7 ++++ ...090908_add_data_to_installations_table.php | 32 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 database/migrations/2022_12_01_090908_add_data_to_installations_table.php diff --git a/app/Models/Installation.php b/app/Models/Installation.php index d6f9fff..396b6d8 100644 --- a/app/Models/Installation.php +++ b/app/Models/Installation.php @@ -23,6 +23,13 @@ class Installation extends Model 'type', ]; + /** + * {@inheritdoc} + */ + protected $casts = [ + 'data' => 'array', + ]; + /** * Get the country associated with the Installation * diff --git a/database/migrations/2022_12_01_090908_add_data_to_installations_table.php b/database/migrations/2022_12_01_090908_add_data_to_installations_table.php new file mode 100644 index 0000000..05f843e --- /dev/null +++ b/database/migrations/2022_12_01_090908_add_data_to_installations_table.php @@ -0,0 +1,32 @@ +json('data')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('installations', function (Blueprint $table) { + $table->dropColumn('data'); + }); + } +};