diff --git a/database/factories/ServiceFactory.php b/database/factories/ServiceFactory.php new file mode 100644 index 0000000..b3d1d37 --- /dev/null +++ b/database/factories/ServiceFactory.php @@ -0,0 +1,29 @@ + $this->faker->sentence($nbWords = 6, $variableNbWords = true), + 'description' => $this->faker->sentence($nbWords = 6, $variableNbWords = true), + 'status' => $this->faker->randomElement(['published', 'draft']), + ]; + } +} diff --git a/database/migrations/create_services_table.php.stub b/database/migrations/create_services_table.php.stub new file mode 100644 index 0000000..3f264c4 --- /dev/null +++ b/database/migrations/create_services_table.php.stub @@ -0,0 +1,35 @@ +id(); + $table->string('name')->nullable(); + $table->text('description')->nullable(); + $table->enum('status', ['published', 'draft'])->default('draft'); + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('services'); + } +} diff --git a/models/Service.php b/models/Service.php new file mode 100644 index 0000000..52dcfaa --- /dev/null +++ b/models/Service.php @@ -0,0 +1,22 @@ +app->runningInConsole()) { - $this->publishes([ __DIR__ . '/../models' => app_path('Models/Tepuilabs/SimpleCrm'), ], 'simple-crm-models'); @@ -17,6 +16,7 @@ public function boot(): void $migrationFileNames = [ 'create_leads_table.php', 'create_notes_table.php', + 'create_services_table.php', ]; foreach ($migrationFileNames as $key) { diff --git a/tests/Models/Service.php b/tests/Models/Service.php new file mode 100644 index 0000000..5d1776b --- /dev/null +++ b/tests/Models/Service.php @@ -0,0 +1,22 @@ +up(); (new \CreateLeadsTable())->up(); (new \CreateNotesTable())->up(); + (new \CreateServicesTable())->up(); } } diff --git a/tests/Unit/ServiceTest.php b/tests/Unit/ServiceTest.php new file mode 100644 index 0000000..b6ed08f --- /dev/null +++ b/tests/Unit/ServiceTest.php @@ -0,0 +1,16 @@ +create(); + + $this->assertInstanceOf(\Tepuilabs\SimpleCrm\Tests\Models\Service::class, $service); + } +}