add basic structure
parent
38284947e0
commit
a1fc63dd8e
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Enums;
|
||||||
|
|
||||||
|
use BenSampo\Enum\Enum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method static static BuyContractUnsigned()
|
||||||
|
* @method static static BuyContractSigned()
|
||||||
|
* @method static static SellContractUnSigned()
|
||||||
|
* @method static static SellContractSigned()
|
||||||
|
* @method static static Other()
|
||||||
|
*/
|
||||||
|
final class DocumentType extends Enum
|
||||||
|
{
|
||||||
|
const BuyContractUnsigned = 0;
|
||||||
|
const BuyContractSigned = 1;
|
||||||
|
const SellContractUnSigned = 2;
|
||||||
|
const SellContractSigned = 3;
|
||||||
|
const Other = 4;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Enums;
|
||||||
|
|
||||||
|
use BenSampo\Enum\Enum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method static static OptionOne()
|
||||||
|
* @method static static OptionTwo()
|
||||||
|
* @method static static OptionThree()
|
||||||
|
* @method static static OptionFour()
|
||||||
|
* @method static static OptionFive()
|
||||||
|
*/
|
||||||
|
final class InsuranceType extends Enum
|
||||||
|
{
|
||||||
|
const OptionOne = 0;
|
||||||
|
const OptionTwo = 1;
|
||||||
|
const OptionThree = 2;
|
||||||
|
const OptionFour = 3;
|
||||||
|
const OptionFive = 4;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Enums;
|
||||||
|
|
||||||
|
use BenSampo\Enum\Enum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method static static Transaction()
|
||||||
|
* @method static static Cash()
|
||||||
|
*/
|
||||||
|
final class PaymentType extends Enum
|
||||||
|
{
|
||||||
|
const Transaction = 0;
|
||||||
|
const Cash = 1;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Brand;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class BrandController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\Models\Brand $brand
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function show(Brand $brand)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\Models\Brand $brand
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit(Brand $brand)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \App\Models\Brand $brand
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request, Brand $brand)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param \App\Models\Brand $brand
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy(Brand $brand)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\CarModel;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class CarModelController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\Models\CarModel $carModel
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function show(CarModel $carModel)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\Models\CarModel $carModel
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit(CarModel $carModel)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \App\Models\CarModel $carModel
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request, CarModel $carModel)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param \App\Models\CarModel $carModel
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy(CarModel $carModel)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class CarPaymentController extends Controller
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ContractController extends Controller
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class DocumentController extends Controller
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Brand extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = ['brand'];
|
||||||
|
|
||||||
|
public function cars()
|
||||||
|
{
|
||||||
|
return $this->hasManyThrough(Car::class, CarModel::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function carModels()
|
||||||
|
{
|
||||||
|
return $this->hasMany(CarModel::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class CarModel extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'car_model',
|
||||||
|
'brand_id',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function brand()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Brand::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function cars()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Car::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class CarPayment extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'amount',
|
||||||
|
'paid_at',
|
||||||
|
'payment_type',
|
||||||
|
'contract_id'
|
||||||
|
];
|
||||||
|
|
||||||
|
public function contract()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Contract::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function car()
|
||||||
|
{
|
||||||
|
return $this->hasOneThrough(Car::class, Contract::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -8,4 +8,32 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
class Contact extends Model
|
class Contact extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
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');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Contract extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'sold_at',
|
||||||
|
'sell_price',
|
||||||
|
'contact_id',
|
||||||
|
'car_id',
|
||||||
|
'insurance_type',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function contact()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Contact::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function car()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Car::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Document extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'name',
|
||||||
|
'document_type',
|
||||||
|
'car_id',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function car()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Car::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.3|^8.0",
|
"php": "^7.3|^8.0",
|
||||||
|
"bensampo/laravel-enum": "^3.3",
|
||||||
"fideloper/proxy": "^4.4",
|
"fideloper/proxy": "^4.4",
|
||||||
"fruitcake/laravel-cors": "^2.0",
|
"fruitcake/laravel-cors": "^2.0",
|
||||||
"guzzlehttp/guzzle": "^7.0.1",
|
"guzzlehttp/guzzle": "^7.0.1",
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "9152521bce7b1f12fdec80ac14a17f93",
|
"content-hash": "a3bbf3a4cbd2672bb4b1dd877e708146",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "asm89/stack-cors",
|
"name": "asm89/stack-cors",
|
||||||
|
|
@ -115,6 +115,89 @@
|
||||||
},
|
},
|
||||||
"time": "2020-10-30T02:02:47+00:00"
|
"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",
|
"name": "brick/math",
|
||||||
"version": "0.9.2",
|
"version": "0.9.2",
|
||||||
|
|
@ -956,6 +1039,55 @@
|
||||||
},
|
},
|
||||||
"time": "2021-04-26T09:17:50+00:00"
|
"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",
|
"name": "inertiajs/inertia-laravel",
|
||||||
"version": "v0.3.6",
|
"version": "v0.3.6",
|
||||||
|
|
@ -1155,6 +1287,202 @@
|
||||||
],
|
],
|
||||||
"time": "2020-06-13T08:05:20+00:00"
|
"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",
|
"name": "laravel/fortify",
|
||||||
"version": "v1.7.12",
|
"version": "v1.7.12",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use App\Models\Brand;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
|
class BrandFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = Brand::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function definition()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'brand' => $this->faker->word(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
namespace Database\Factories;
|
namespace Database\Factories;
|
||||||
|
|
||||||
use App\Models\Car;
|
use App\Models\Car;
|
||||||
|
use App\Models\CarModel;
|
||||||
|
use App\Models\Contact;
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
class CarFactory extends Factory
|
class CarFactory extends Factory
|
||||||
|
|
@ -22,7 +24,17 @@ class CarFactory extends Factory
|
||||||
public function definition()
|
public function definition()
|
||||||
{
|
{
|
||||||
return [
|
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()),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use App\Models\CarModel;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
use App\Models\Brand;
|
||||||
|
|
||||||
|
class CarModelFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = CarModel::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function definition()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'car_model' => $this->faker->word(),
|
||||||
|
'brand_id' => $this->faker->numberBetween(1, Brand::count()),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use App\Models\CarPayment;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
use App\Enums\PaymentType;
|
||||||
|
use App\Models\Contract;
|
||||||
|
|
||||||
|
class CarPaymentFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = CarPayment::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function definition()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'amount' => $this->faker->numberBetween(1000, 10000),
|
||||||
|
'paid_at' => $this->faker->date(),
|
||||||
|
'payment_type' => (string)PaymentType::getRandomValue(),
|
||||||
|
'contract_id' => $this->faker->numberBetween(1, Contract::count()),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,6 +4,10 @@ namespace Database\Factories;
|
||||||
|
|
||||||
use App\Models\Contact;
|
use App\Models\Contact;
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
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
|
class ContactFactory extends Factory
|
||||||
{
|
{
|
||||||
|
|
@ -22,7 +26,15 @@ class ContactFactory extends Factory
|
||||||
public function definition()
|
public function definition()
|
||||||
{
|
{
|
||||||
return [
|
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(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use App\Models\Contract;
|
||||||
|
use App\Models\Car;
|
||||||
|
use App\Models\Contact;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
use App\Enums\InsuranceType;
|
||||||
|
|
||||||
|
class ContractFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = Contract::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function definition()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'sold_at' => $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(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use App\Models\Document;
|
||||||
|
use App\Models\Car;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
use App\Enums\DocumentType;
|
||||||
|
|
||||||
|
|
||||||
|
class DocumentFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = Document::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function definition()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => $this->faker->name(),
|
||||||
|
'car_id' => $this->faker->numberBetween(1, Car::count()),
|
||||||
|
'document_type' => (string)DocumentType::getRandomValue(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreateContactsTable extends Migration
|
class CreateBrandsTable extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
|
|
@ -13,8 +13,9 @@ class CreateContactsTable extends Migration
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('contacts', function (Blueprint $table) {
|
Schema::create('brands', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
|
$table->string('brand')->unique();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -26,6 +27,6 @@ class CreateContactsTable extends Migration
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('contacts');
|
Schema::dropIfExists('brands');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateContactsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('contacts', function (Blueprint $table) {
|
||||||
|
$table->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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateCarModelsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('car_models', function (Blueprint $table) {
|
||||||
|
$table->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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -15,7 +15,23 @@ class CreateCarsTable extends Migration
|
||||||
{
|
{
|
||||||
Schema::create('cars', function (Blueprint $table) {
|
Schema::create('cars', function (Blueprint $table) {
|
||||||
$table->id();
|
$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->timestamps();
|
||||||
|
|
||||||
|
$table->foreign('seller_contact_id')->references('id')->on('contacts');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use App\Enums\InsuranceType;
|
||||||
|
|
||||||
|
class CreateContractsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('contracts', function (Blueprint $table) {
|
||||||
|
$table->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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use App\Enums\DocumentType;
|
||||||
|
|
||||||
|
class CreateDocumentsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('documents', function (Blueprint $table) {
|
||||||
|
$table->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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use App\Enums\PaymentType;
|
||||||
|
|
||||||
|
class CreateCarPaymentsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('car_payments', function (Blueprint $table) {
|
||||||
|
$table->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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Database\Seeders;
|
|
||||||
|
|
||||||
use Illuminate\Database\Seeder;
|
|
||||||
|
|
||||||
class CarSeeder extends Seeder
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the database seeds.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function run()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Database\Seeders;
|
|
||||||
|
|
||||||
use Illuminate\Database\Seeder;
|
|
||||||
|
|
||||||
class ContactSeeder extends Seeder
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the database seeds.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function run()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -3,6 +3,15 @@
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\Car;
|
||||||
|
use App\Models\CarModel;
|
||||||
|
use App\Models\Brand;
|
||||||
|
use App\Models\CarPayment;
|
||||||
|
use App\Models\Contract;
|
||||||
|
use App\Models\Contact;
|
||||||
|
use App\Models\Document;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class DatabaseSeeder extends Seeder
|
class DatabaseSeeder extends Seeder
|
||||||
{
|
{
|
||||||
|
|
@ -13,6 +22,113 @@ class DatabaseSeeder extends Seeder
|
||||||
*/
|
*/
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
// \App\Models\User::factory(10)->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"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue