From 08133d0b057c400c3f0d602fed57cca99ed4b7a3 Mon Sep 17 00:00:00 2001 From: Kamil Niemczycki Date: Fri, 16 Jun 2023 00:47:37 +0200 Subject: [PATCH] - wip --- app/Console/Commands/CreateCV.php | 40 +++++++++++++++++++ app/Models/CV.php | 28 +++++++++++++ .../2023_06_15_220540_create_cvs_table.php | 28 +++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 app/Console/Commands/CreateCV.php create mode 100644 app/Models/CV.php create mode 100644 database/migrations/2023_06_15_220540_create_cvs_table.php diff --git a/app/Console/Commands/CreateCV.php b/app/Console/Commands/CreateCV.php new file mode 100644 index 0000000..84c8f14 --- /dev/null +++ b/app/Console/Commands/CreateCV.php @@ -0,0 +1,40 @@ +argument('recipient'); + $email = $this->argument('email'); + $phone = $this->argument('phone'); + $locations = $this->argument('location'); + + CV::query() + ->create([ + // 'slug' => Str::ra, + 'recipient' => $recipient, + 'email' => $email, + 'phone-number' => $phone, + 'locations' => $locations, + ]); + + return CommandAlias::SUCCESS; + } +} diff --git a/app/Models/CV.php b/app/Models/CV.php new file mode 100644 index 0000000..5dd4c32 --- /dev/null +++ b/app/Models/CV.php @@ -0,0 +1,28 @@ + 'array', + 'views' => 'integer', + ]; +} diff --git a/database/migrations/2023_06_15_220540_create_cvs_table.php b/database/migrations/2023_06_15_220540_create_cvs_table.php new file mode 100644 index 0000000..a7560d9 --- /dev/null +++ b/database/migrations/2023_06_15_220540_create_cvs_table.php @@ -0,0 +1,28 @@ +id(); + $table->string('recipient', 255); + $table->string('email', 255); + $table->string('phone-number', 15); + $table->json('locations'); + $table->integer('views')->nullable()->default(0); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('cvs'); + } +};