diff --git a/app/Enums/DocumentType.php b/app/Enums/DocumentType.php new file mode 100644 index 0000000..cf60542 --- /dev/null +++ b/app/Enums/DocumentType.php @@ -0,0 +1,21 @@ +hasManyThrough(Car::class, CarModel::class); + } + + public function carModels() + { + return $this->hasMany(CarModel::class); + } +} diff --git a/app/Models/CarModel.php b/app/Models/CarModel.php new file mode 100644 index 0000000..da24632 --- /dev/null +++ b/app/Models/CarModel.php @@ -0,0 +1,26 @@ +belongsTo(Brand::class); + } + + public function cars() + { + return $this->hasMany(Car::class); + } +} diff --git a/app/Models/CarPayment.php b/app/Models/CarPayment.php new file mode 100644 index 0000000..d828f26 --- /dev/null +++ b/app/Models/CarPayment.php @@ -0,0 +1,28 @@ +belongsTo(Contract::class); + } + + public function car() + { + return $this->hasOneThrough(Car::class, Contract::class); + } +} diff --git a/app/Models/Contact.php b/app/Models/Contact.php index c843206..28d8324 100644 --- a/app/Models/Contact.php +++ b/app/Models/Contact.php @@ -8,4 +8,32 @@ use Illuminate\Database\Eloquent\Model; class Contact extends Model { use HasFactory; + + protected $fillable = [ + 'firstname', + 'lastname', + 'phone', + 'street', + 'zip', + 'city', + 'country', + 'company', + 'email', + 'notes', + ]; + + public function contracts() + { + return $this->hasMany(Contracts::class); + } + + public function boughtCars() + { + return $this->hasManyThrough(Car::class, Contracts::class); + } + + public function soldCars() + { + return $this->hasMany(Car::class, 'seller_id'); + } } diff --git a/app/Models/Contract.php b/app/Models/Contract.php new file mode 100644 index 0000000..5a154a8 --- /dev/null +++ b/app/Models/Contract.php @@ -0,0 +1,29 @@ +belongsTo(Contact::class); + } + + public function car() + { + return $this->belongsTo(Car::class); + } +} diff --git a/app/Models/Document.php b/app/Models/Document.php new file mode 100644 index 0000000..5e627e2 --- /dev/null +++ b/app/Models/Document.php @@ -0,0 +1,22 @@ +belongsTo(Car::class); + } +} diff --git a/composer.json b/composer.json index be9b042..b58b49e 100644 --- a/composer.json +++ b/composer.json @@ -6,6 +6,7 @@ "license": "MIT", "require": { "php": "^7.3|^8.0", + "bensampo/laravel-enum": "^3.3", "fideloper/proxy": "^4.4", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.0.1", diff --git a/composer.lock b/composer.lock index ed0cfad..e575075 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9152521bce7b1f12fdec80ac14a17f93", + "content-hash": "a3bbf3a4cbd2672bb4b1dd877e708146", "packages": [ { "name": "asm89/stack-cors", @@ -115,6 +115,89 @@ }, "time": "2020-10-30T02:02:47+00:00" }, + { + "name": "bensampo/laravel-enum", + "version": "v3.3.0", + "source": { + "type": "git", + "url": "https://github.com/BenSampo/laravel-enum.git", + "reference": "82d1ad8127e6fdd19f8fb86bf4b06cc80db6c9c0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/BenSampo/laravel-enum/zipball/82d1ad8127e6fdd19f8fb86bf4b06cc80db6c9c0", + "reference": "82d1ad8127e6fdd19f8fb86bf4b06cc80db6c9c0", + "shasum": "" + }, + "require": { + "hanneskod/classtools": "^1.2", + "illuminate/contracts": "^8.0", + "illuminate/support": "^8.0", + "laminas/laminas-code": "^3.4", + "nikic/php-parser": "^4.10", + "php": "^7.3|^8.0" + }, + "require-dev": { + "doctrine/dbal": "^2.9|^3.0", + "mockery/mockery": "^1.4", + "orchestra/testbench": "^6.2", + "phpstan/phpstan": "^0.12.59", + "phpunit/phpunit": "^8.5", + "squizlabs/php_codesniffer": "^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + }, + "laravel": { + "providers": [ + "BenSampo\\Enum\\EnumServiceProvider" + ] + }, + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "psr-4": { + "BenSampo\\Enum\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ben Sampson", + "homepage": "https://sampo.co.uk", + "role": "Developer" + } + ], + "description": "Simple, extensible and powerful enumeration implementation for Laravel.", + "homepage": "https://github.com/bensampo/laravel-enum", + "keywords": [ + "bensampo", + "enum", + "laravel", + "package", + "validation" + ], + "support": { + "issues": "https://github.com/BenSampo/laravel-enum/issues", + "source": "https://github.com/BenSampo/laravel-enum/tree/v3.3.0" + }, + "funding": [ + { + "url": "https://github.com/bensampo", + "type": "github" + } + ], + "time": "2021-02-16T17:27:06+00:00" + }, { "name": "brick/math", "version": "0.9.2", @@ -956,6 +1039,55 @@ }, "time": "2021-04-26T09:17:50+00:00" }, + { + "name": "hanneskod/classtools", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/hanneskod/classtools.git", + "reference": "d365ddac0e602027c0471ea292f4ba2afcb49394" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hanneskod/classtools/zipball/d365ddac0e602027c0471ea292f4ba2afcb49394", + "reference": "d365ddac0e602027c0471ea292f4ba2afcb49394", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4", + "php": ">=7.1", + "symfony/finder": "^4|^5" + }, + "type": "library", + "autoload": { + "psr-4": { + "hanneskod\\classtools\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "WTFPL" + ], + "authors": [ + { + "name": "Hannes Forsgård", + "email": "hannes.forsgard@fripost.org" + } + ], + "description": "Find, extract and process classes from file system", + "homepage": "https://github.com/hanneskod/classtools", + "keywords": [ + "class finder", + "code generator", + "metaprogramming", + "minimizer" + ], + "support": { + "issues": "https://github.com/hanneskod/classtools/issues", + "source": "https://github.com/hanneskod/classtools/tree/1.0" + }, + "time": "2020-03-05T20:41:28+00:00" + }, { "name": "inertiajs/inertia-laravel", "version": "v0.3.6", @@ -1155,6 +1287,202 @@ ], "time": "2020-06-13T08:05:20+00:00" }, + { + "name": "laminas/laminas-code", + "version": "3.5.1", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-code.git", + "reference": "b549b70c0bb6e935d497f84f750c82653326ac77" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-code/zipball/b549b70c0bb6e935d497f84f750c82653326ac77", + "reference": "b549b70c0bb6e935d497f84f750c82653326ac77", + "shasum": "" + }, + "require": { + "laminas/laminas-eventmanager": "^3.3", + "laminas/laminas-zendframework-bridge": "^1.1", + "php": "^7.3 || ~8.0.0" + }, + "conflict": { + "phpspec/prophecy": "<1.9.0" + }, + "replace": { + "zendframework/zend-code": "^3.4.1" + }, + "require-dev": { + "doctrine/annotations": "^1.10.4", + "ext-phar": "*", + "laminas/laminas-coding-standard": "^1.0.0", + "laminas/laminas-stdlib": "^3.3.0", + "phpunit/phpunit": "^9.4.2" + }, + "suggest": { + "doctrine/annotations": "Doctrine\\Common\\Annotations >=1.0 for annotation features", + "laminas/laminas-stdlib": "Laminas\\Stdlib component" + }, + "type": "library", + "autoload": { + "psr-4": { + "Laminas\\Code\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Extensions to the PHP Reflection API, static code scanning, and code generation", + "homepage": "https://laminas.dev", + "keywords": [ + "code", + "laminas" + ], + "support": { + "chat": "https://laminas.dev/chat", + "docs": "https://docs.laminas.dev/laminas-code/", + "forum": "https://discourse.laminas.dev", + "issues": "https://github.com/laminas/laminas-code/issues", + "rss": "https://github.com/laminas/laminas-code/releases.atom", + "source": "https://github.com/laminas/laminas-code" + }, + "funding": [ + { + "url": "https://funding.communitybridge.org/projects/laminas-project", + "type": "community_bridge" + } + ], + "time": "2020-11-30T20:16:31+00:00" + }, + { + "name": "laminas/laminas-eventmanager", + "version": "3.3.1", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-eventmanager.git", + "reference": "966c859b67867b179fde1eff0cd38df51472ce4a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-eventmanager/zipball/966c859b67867b179fde1eff0cd38df51472ce4a", + "reference": "966c859b67867b179fde1eff0cd38df51472ce4a", + "shasum": "" + }, + "require": { + "laminas/laminas-zendframework-bridge": "^1.0", + "php": "^7.3 || ^8.0" + }, + "replace": { + "zendframework/zend-eventmanager": "^3.2.1" + }, + "require-dev": { + "container-interop/container-interop": "^1.1", + "laminas/laminas-coding-standard": "~1.0.0", + "laminas/laminas-stdlib": "^2.7.3 || ^3.0", + "phpbench/phpbench": "^0.17.1", + "phpunit/phpunit": "^8.5.8" + }, + "suggest": { + "container-interop/container-interop": "^1.1, to use the lazy listeners feature", + "laminas/laminas-stdlib": "^2.7.3 || ^3.0, to use the FilterChain feature" + }, + "type": "library", + "autoload": { + "psr-4": { + "Laminas\\EventManager\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Trigger and listen to events within a PHP application", + "homepage": "https://laminas.dev", + "keywords": [ + "event", + "eventmanager", + "events", + "laminas" + ], + "support": { + "chat": "https://laminas.dev/chat", + "docs": "https://docs.laminas.dev/laminas-eventmanager/", + "forum": "https://discourse.laminas.dev", + "issues": "https://github.com/laminas/laminas-eventmanager/issues", + "rss": "https://github.com/laminas/laminas-eventmanager/releases.atom", + "source": "https://github.com/laminas/laminas-eventmanager" + }, + "funding": [ + { + "url": "https://funding.communitybridge.org/projects/laminas-project", + "type": "community_bridge" + } + ], + "time": "2021-03-08T15:24:29+00:00" + }, + { + "name": "laminas/laminas-zendframework-bridge", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-zendframework-bridge.git", + "reference": "6cccbddfcfc742eb02158d6137ca5687d92cee32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/6cccbddfcfc742eb02158d6137ca5687d92cee32", + "reference": "6cccbddfcfc742eb02158d6137ca5687d92cee32", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.1 || ^9.3", + "psalm/plugin-phpunit": "^0.15.1", + "squizlabs/php_codesniffer": "^3.5", + "vimeo/psalm": "^4.6" + }, + "type": "library", + "extra": { + "laminas": { + "module": "Laminas\\ZendFrameworkBridge" + } + }, + "autoload": { + "files": [ + "src/autoload.php" + ], + "psr-4": { + "Laminas\\ZendFrameworkBridge\\": "src//" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Alias legacy ZF class names to Laminas Project equivalents.", + "keywords": [ + "ZendFramework", + "autoloading", + "laminas", + "zf" + ], + "support": { + "forum": "https://discourse.laminas.dev/", + "issues": "https://github.com/laminas/laminas-zendframework-bridge/issues", + "rss": "https://github.com/laminas/laminas-zendframework-bridge/releases.atom", + "source": "https://github.com/laminas/laminas-zendframework-bridge" + }, + "funding": [ + { + "url": "https://funding.communitybridge.org/projects/laminas-project", + "type": "community_bridge" + } + ], + "time": "2021-02-25T21:54:58+00:00" + }, { "name": "laravel/fortify", "version": "v1.7.12", diff --git a/database/factories/BrandFactory.php b/database/factories/BrandFactory.php new file mode 100644 index 0000000..b4ed7be --- /dev/null +++ b/database/factories/BrandFactory.php @@ -0,0 +1,28 @@ + $this->faker->word(), + ]; + } +} diff --git a/database/factories/CarFactory.php b/database/factories/CarFactory.php index 24a50e5..d232c78 100644 --- a/database/factories/CarFactory.php +++ b/database/factories/CarFactory.php @@ -3,6 +3,8 @@ namespace Database\Factories; use App\Models\Car; +use App\Models\CarModel; +use App\Models\Contact; use Illuminate\Database\Eloquent\Factories\Factory; class CarFactory extends Factory @@ -22,7 +24,17 @@ class CarFactory extends Factory public function definition() { return [ - // + 'variation' => $this->faker->word(), + 'stammnummer' => $this->faker->randomNumber(9, true), + 'vin' => $this->faker->regexify('[A-Z]{3}ZZZ[A-Z0-9]{3}[A-Z1-9]{1}[A-Z]{1}[0-9]{6}'), + 'colour' => $this->faker->safeColorName(), + 'notes' => $this->faker->paragraph(), + 'known_damage' => $this->faker->paragraph(), + 'initial_date' => $this->faker->date(), + 'bought_at' => $this->faker->date(), + 'buy_price' => $this->faker->numberBetween(1000, 30000), + 'seller_contact_id' => $this->faker->numberBetween(1, Contact::count()), + 'car_model_id' => $this->faker->numberBetween(1, CarModel::count()), ]; } } diff --git a/database/factories/CarModelFactory.php b/database/factories/CarModelFactory.php new file mode 100644 index 0000000..f5c91dc --- /dev/null +++ b/database/factories/CarModelFactory.php @@ -0,0 +1,30 @@ + $this->faker->word(), + 'brand_id' => $this->faker->numberBetween(1, Brand::count()), + ]; + } +} diff --git a/database/factories/CarPaymentFactory.php b/database/factories/CarPaymentFactory.php new file mode 100644 index 0000000..fd9f28a --- /dev/null +++ b/database/factories/CarPaymentFactory.php @@ -0,0 +1,33 @@ + $this->faker->numberBetween(1000, 10000), + 'paid_at' => $this->faker->date(), + 'payment_type' => (string)PaymentType::getRandomValue(), + 'contract_id' => $this->faker->numberBetween(1, Contract::count()), + ]; + } +} diff --git a/database/factories/ContactFactory.php b/database/factories/ContactFactory.php index dcacfaf..ba828f5 100644 --- a/database/factories/ContactFactory.php +++ b/database/factories/ContactFactory.php @@ -4,6 +4,10 @@ namespace Database\Factories; use App\Models\Contact; use Illuminate\Database\Eloquent\Factories\Factory; +use Faker\Provider\de_CH\PhoneNumber; +use Faker\Provider\en_US\Person; +use Faker\Provider\en_US\Address; +use Faker\Provider\en_US\Company; class ContactFactory extends Factory { @@ -22,7 +26,15 @@ class ContactFactory extends Factory public function definition() { return [ - // + 'firstname' => $this->faker->firstName(), + 'lastname' => $this->faker->lastName(), + 'phone' => $this->faker->PhoneNumber(), + 'street' => $this->faker->streetName(), + 'zip' => $this->faker->postcode(), + 'city' => $this->faker->city(), + 'country' => $this->faker->countryCode(), + 'company' => $this->faker->company(), + 'notes' => $this->faker->text(), ]; } } diff --git a/database/factories/ContractFactory.php b/database/factories/ContractFactory.php new file mode 100644 index 0000000..f819d34 --- /dev/null +++ b/database/factories/ContractFactory.php @@ -0,0 +1,35 @@ + $this->faker->date(), + 'sell_price' => $this->faker->numberBetween(1500, 35000), + 'contact_id' => $this->faker->numberBetween(1, Contact::count()), + 'car_id' => $this->faker->unique()->numberBetween(1, Car::count()), + 'insurance_type' => (string)InsuranceType::getRandomValue(), + ]; + } +} diff --git a/database/factories/DocumentFactory.php b/database/factories/DocumentFactory.php new file mode 100644 index 0000000..810f368 --- /dev/null +++ b/database/factories/DocumentFactory.php @@ -0,0 +1,33 @@ + $this->faker->name(), + 'car_id' => $this->faker->numberBetween(1, Car::count()), + 'document_type' => (string)DocumentType::getRandomValue(), + ]; + } +} diff --git a/database/migrations/2021_05_10_140156_create_contacts_table.php b/database/migrations/2021_05_10_135028_create_brands_table.php similarity index 69% rename from database/migrations/2021_05_10_140156_create_contacts_table.php rename to database/migrations/2021_05_10_135028_create_brands_table.php index e5e6ba6..41dfc6a 100644 --- a/database/migrations/2021_05_10_140156_create_contacts_table.php +++ b/database/migrations/2021_05_10_135028_create_brands_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreateContactsTable extends Migration +class CreateBrandsTable extends Migration { /** * Run the migrations. @@ -13,8 +13,9 @@ class CreateContactsTable extends Migration */ public function up() { - Schema::create('contacts', function (Blueprint $table) { + Schema::create('brands', function (Blueprint $table) { $table->id(); + $table->string('brand')->unique(); $table->timestamps(); }); } @@ -26,6 +27,6 @@ class CreateContactsTable extends Migration */ public function down() { - Schema::dropIfExists('contacts'); + Schema::dropIfExists('brands'); } } diff --git a/database/migrations/2021_05_10_135156_create_contacts_table.php b/database/migrations/2021_05_10_135156_create_contacts_table.php new file mode 100644 index 0000000..c7419ad --- /dev/null +++ b/database/migrations/2021_05_10_135156_create_contacts_table.php @@ -0,0 +1,41 @@ +id(); + $table->string('firstname')->nullable(); + $table->string('lastname')->nullable(); + $table->string('phone'); + $table->string('street')->nullable(); + $table->string('zip')->nullable(); + $table->string('city')->nullable(); + $table->string('country')->nullable(); + $table->string('company')->nullable(); + $table->string('email')->nullable(); + $table->text('notes')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('contacts'); + } +} diff --git a/database/migrations/2021_05_10_135208_create_car_models_table.php b/database/migrations/2021_05_10_135208_create_car_models_table.php new file mode 100644 index 0000000..5f151ac --- /dev/null +++ b/database/migrations/2021_05_10_135208_create_car_models_table.php @@ -0,0 +1,36 @@ +id(); + $table->string('car_model'); + $table->foreignId('brand_id') + ->onUpdate('cascade') + ->onDelete('cascade') + ->constrained('brands'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('car_models'); + } +} diff --git a/database/migrations/2021_05_10_135957_create_cars_table.php b/database/migrations/2021_05_10_135957_create_cars_table.php index 8ae4c25..091c5bd 100644 --- a/database/migrations/2021_05_10_135957_create_cars_table.php +++ b/database/migrations/2021_05_10_135957_create_cars_table.php @@ -15,7 +15,23 @@ class CreateCarsTable extends Migration { Schema::create('cars', function (Blueprint $table) { $table->id(); + $table->string('variation'); + $table->integer('stammnummer'); + $table->string('vin', 17); + $table->string('colour')->nullable(); + $table->text('notes')->nullable(); + $table->text('known_damage')->nullable(); + $table->date('initial_date'); + $table->date('bought_at'); + $table->integer('buy_price'); + $table->unsignedBigInteger('seller_contact_id'); + $table->foreignId('car_model_id') + ->onUpdate('cascade') + ->onDelete('cascade') + ->constrained('car_models'); $table->timestamps(); + + $table->foreign('seller_contact_id')->references('id')->on('contacts'); }); } diff --git a/database/migrations/2021_05_10_144041_create_contracts_table.php b/database/migrations/2021_05_10_144041_create_contracts_table.php new file mode 100644 index 0000000..9ae7ea6 --- /dev/null +++ b/database/migrations/2021_05_10_144041_create_contracts_table.php @@ -0,0 +1,44 @@ +id(); + $table->date('sold_at'); + $table->integer('sell_price'); + $table->foreignId('contact_id') + ->onUpdate('cascade') + ->onDelete('cascade') + ->constrained('contacts'); + $table->foreignId('car_id') + ->onUpdate('cascade') + ->onDelete('cascade') + ->constrained('cars'); + $table->enum('insurance_type', InsuranceType::getValues()) + ->default(InsuranceType::OptionOne); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('contracts'); + } +} diff --git a/database/migrations/2021_05_10_144114_create_documents_table.php b/database/migrations/2021_05_10_144114_create_documents_table.php new file mode 100644 index 0000000..694dd29 --- /dev/null +++ b/database/migrations/2021_05_10_144114_create_documents_table.php @@ -0,0 +1,39 @@ +id(); + $table->string('name'); + $table->enum('document_type', DocumentType::getValues()) + ->default(DocumentType::Other); + $table->foreignId('car_id') + ->onUpdate('cascade') + ->onDelete('cascade') + ->constrained('cars'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('documents'); + } +} diff --git a/database/migrations/2021_05_10_144704_create_car_payments_table.php b/database/migrations/2021_05_10_144704_create_car_payments_table.php new file mode 100644 index 0000000..0f9a15a --- /dev/null +++ b/database/migrations/2021_05_10_144704_create_car_payments_table.php @@ -0,0 +1,40 @@ +id(); + $table->integer('amount'); + $table->date('paid_at'); + $table->enum('payment_type', PaymentType::getValues()) + ->default(PaymentType::Transaction); + $table->foreignId('contract_id') + ->onUpdate('cascade') + ->onDelete('cascade') + ->constrained('contracts'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('car_payments'); + } +} diff --git a/database/seeders/CarSeeder.php b/database/seeders/CarSeeder.php deleted file mode 100644 index 9c017f2..0000000 --- a/database/seeders/CarSeeder.php +++ /dev/null @@ -1,18 +0,0 @@ -create(); + DB::statement('SET FOREIGN_KEY_CHECKS=0;'); + CarPayment::truncate(); + Contract::truncate(); + Document::truncate(); + Car::truncate(); + Contact::truncate(); + CarModel::truncate(); + Brand::truncate(); + DB::statement('SET FOREIGN_KEY_CHECKS=1;'); + + foreach ($this->getBrands() as $brand) { + Brand::create(['brand' => $brand]); + } + + $carModels = CarModel::factory() + ->count(350) + ->create(); + + $contacts = Contact::factory() + ->count(100) + ->create(); + + $cars = Car::factory() + ->count(40) + ->create(); + + $contracts = Contract::factory() + ->count(20) + ->create(); + + $carPayments = CarPayment::factory() + ->count(15) + ->create(); + + $documents = Document::factory() + ->count(10) + ->create(); } + + public function getBrands(): array + { + return [ + "Abarth", + "Alfa Romeo", + "Aston Martin", + "Audi", + "Bentley", + "BMW", + "Bugatti", + "Cadillac", + "Chevrolet", + "Chrysler", + "Citroën", + "Dacia", + "Daewoo", + "Daihatsu", + "Dodge", + "Donkervoort", + "DS", + "Ferrari", + "Fiat", + "Fisker", + "Ford", + "Honda", + "Hummer", + "Hyundai", + "Infiniti", + "Iveco", + "Jaguar", + "Jeep", + "Kia", + "KTM", + "Lada", + "Lamborghini", + "Lancia", + "Land Rover", + "Landwind", + "Lexus", + "Lotus", + "Maserati", + "Maybach", + "Mazda", + "McLaren", + "Mercedes-Benz", + "MG", + "Mini", + "Mitsubishi", + "Morgan", + "Nissan", + "Opel", + "Peugeot", + "Porsche", + "Renault", + "Rolls-Royce", + "Rover", + "Saab", + "Seat", + "Skoda", + "Smart", + "SsangYong", + "Subaru", + "Suzuki", + "Tesla", + "Toyota", + "Volkswagen", + "Volvo" + ]; + } + }