sifatbaho
This commit is contained in:
1
database/.gitignore
vendored
Executable file
1
database/.gitignore
vendored
Executable file
@@ -0,0 +1 @@
|
||||
*.sqlite*
|
||||
125
database/factories/AutoOrderFactory.php
Executable file
125
database/factories/AutoOrderFactory.php
Executable file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\OrderStatusEnum;
|
||||
use App\Enums\RoleEnum;
|
||||
use App\Models\AutoOrder;
|
||||
use App\Models\Bonus;
|
||||
use App\Models\OrderMembers;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\AutoOrder>
|
||||
*/
|
||||
class AutoOrderFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'number' => "AUTO-" . $this->faker->numberBetween(10001, 2002),
|
||||
'customer_first_name' => $this->faker->firstName(),
|
||||
'customer_last_name' => $this->faker->lastName(),
|
||||
'customer_patronymic' => $this->faker->userName(),
|
||||
'customer_company' => $this->faker->company(),
|
||||
'customer_type' => $this->faker->randomElement([
|
||||
'juridical', 'physical'
|
||||
]),
|
||||
'owner_first_name' => $this->faker->firstName(),
|
||||
'owner_last_name' => $this->faker->lastName(),
|
||||
'owner_patronymic' => $this->faker->userName(),
|
||||
'owner_company' => $this->faker->company(),
|
||||
'owner_type' => $this->faker->randomElement([
|
||||
'juridical', 'physical'
|
||||
]),
|
||||
'purpose' => $this->faker->randomElement(["CREDIT", "REALIZE", "INVEST", "NOTARIAL"]),
|
||||
'car_mark' => $this->faker->randomElement([
|
||||
'Damas', 'Nexia', 'Nexia 2', 'Nexia 3', 'Spark', 'Cobalt', 'Malibu', 'Gentra'
|
||||
]),
|
||||
'car_category' => $this->faker->randomElement([
|
||||
'local1', 'local2', 'local3', 'local4', 'local5', 'local6', 'import1',
|
||||
'import2', 'import3', 'import4', 'import5', 'import6', 'special1', 'special2',
|
||||
'special3', 'special4', 'special5', 'special6', 'special7', 'special8', 'special9'
|
||||
]),
|
||||
'car_subcategory' => $this->faker->randomElement([
|
||||
'local1', 'local2', 'local3', 'local4', 'local5', 'local6', 'import1',
|
||||
'import2', 'import3', 'import4', 'import5', 'import6', 'special1', 'special2',
|
||||
'special3', 'special4', 'special5', 'special6', 'special7', 'special8', 'special9'
|
||||
]),
|
||||
'color' => $this->faker->colorName(),
|
||||
'diller_id' => User::select('id')
|
||||
->where('role', RoleEnum::APPRAISER->name)
|
||||
->value('id'),
|
||||
'made_date' => $this->faker->date('Y-m-d'),
|
||||
'body' => Str::random(21),
|
||||
'engine' => Str::random(21),
|
||||
//AAF № 3004735 выдан CHILONZOR TRIB от 19.06.2021 года
|
||||
'tech_passport' => "AAF № " . $this->faker->numberBetween(3004735, 3104735) . " выдан " . $this->faker->address() . " от " . $this->faker->date('Y-m-d') . " года",
|
||||
'tech_given_date' => $this->faker->date('Y-m-d'),
|
||||
'tech_given_whom' => $this->faker->address(),
|
||||
'cost' => $this->faker->numberBetween(100000, 100000000),
|
||||
'note' => $this->faker->sentence(10),
|
||||
'type' => $this->faker->sentence(2),
|
||||
'shassi' => $this->faker->sentence(1),
|
||||
'car_number' => $this->faker->randomElement([01, 40, 50, 60, 70, 75, 95, 10, 25, 30, 90]) . " " . strtoupper(Str::random(1)) . " " . $this->faker->numberBetween(0, 999) . " " . strtoupper(Str::random(2)),
|
||||
'status' => $this->faker->randomElement([
|
||||
OrderStatusEnum::DRAFT->name,
|
||||
OrderStatusEnum::STARTED->name,
|
||||
OrderStatusEnum::FINISHED->name,
|
||||
OrderStatusEnum::APPROVED->name,
|
||||
OrderStatusEnum::REJECTED->name
|
||||
])
|
||||
];
|
||||
}
|
||||
|
||||
public function configure(): AutoOrderFactory
|
||||
{
|
||||
return $this->afterCreating(function (AutoOrder $order) {
|
||||
Log::debug("After creating AutoOrderModel", [$order->id, $order->status]);
|
||||
if (in_array($order->status, [
|
||||
OrderStatusEnum::STARTED->name,
|
||||
OrderStatusEnum::FINISHED->name,
|
||||
OrderStatusEnum::APPROVED->name,
|
||||
OrderStatusEnum::REJECTED->name
|
||||
])) {
|
||||
Log::debug('Orders status is', [$order->status]);
|
||||
|
||||
$appraiser = User::select('id')
|
||||
->where('role', RoleEnum::APPRAISER->name)
|
||||
->first();
|
||||
Log::debug("User is role appraiser some one", [$appraiser->id]);
|
||||
|
||||
OrderMembers::factory(1)
|
||||
->create([
|
||||
'user_id' => $appraiser->id,
|
||||
'order_id' => $order->id
|
||||
]);
|
||||
if ($order->status == OrderStatusEnum::APPROVED->name) {
|
||||
Log::debug("Giving bonus to appraiser for order", [$appraiser->id, $order->id]);
|
||||
$givingBonusToOrderAppraiser = User::find($appraiser->id);
|
||||
$bonusAmount = $this->faker->randomElement([10000, 15000, 20000], 1);
|
||||
Log::debug("Bonus amount", [$bonusAmount]);
|
||||
Bonus::factory(1)
|
||||
->create([
|
||||
'appraiser_id' => $appraiser->id,
|
||||
'order_id' => $order->id,
|
||||
'amount' => $bonusAmount
|
||||
]);
|
||||
$balance = $bonusAmount + $givingBonusToOrderAppraiser->balance;
|
||||
$givingBonusToOrderAppraiser->update([
|
||||
'balance' => $balance
|
||||
]);
|
||||
}
|
||||
}
|
||||
return $order;
|
||||
});
|
||||
}
|
||||
}
|
||||
25
database/factories/BonusFactory.php
Executable file
25
database/factories/BonusFactory.php
Executable file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Bonus>
|
||||
*/
|
||||
class BonusFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'appraiser_id' => 1,
|
||||
'order_id' => 1,
|
||||
'amount' => 10000
|
||||
];
|
||||
}
|
||||
}
|
||||
23
database/factories/DebitFactory.php
Executable file
23
database/factories/DebitFactory.php
Executable file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Debit>
|
||||
*/
|
||||
class DebitFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
73
database/factories/EstateOrderFactory.php
Executable file
73
database/factories/EstateOrderFactory.php
Executable file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\OrderStatusEnum;
|
||||
use App\Enums\PurposeEnum;
|
||||
use App\Enums\RoleEnum;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Model>
|
||||
*/
|
||||
class EstateOrderFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'number' => "ESTATE-" . $this->faker->numberBetween(10001, 2002),
|
||||
'customer_first_name' => $this->faker->firstName(),
|
||||
'customer_last_name' => $this->faker->lastName(),
|
||||
'customer_patronymic' => $this->faker->userName(),
|
||||
'customer_company' => $this->faker->company(),
|
||||
'customer_type' => $this->faker->randomElement([
|
||||
'juridical', 'physical'
|
||||
]),
|
||||
'owner_first_name' => $this->faker->firstName(),
|
||||
'owner_last_name' => $this->faker->lastName(),
|
||||
'owner_patronymic' => $this->faker->userName(),
|
||||
'owner_company' => $this->faker->company(),
|
||||
'owner_type' => $this->faker->randomElement([
|
||||
'juridical', 'physical'
|
||||
]),
|
||||
'purpose' => $this->faker->randomElement([
|
||||
PurposeEnum::CREDIT->name,
|
||||
PurposeEnum::REALIZE->name,
|
||||
PurposeEnum::INVEST->name,
|
||||
PurposeEnum::NOTARIAL->name
|
||||
]),
|
||||
'name_of_object' => $this->faker->company(),
|
||||
'contract_date' => $this->faker->date('d-m-Y'),
|
||||
'region' => $this->faker->address(),
|
||||
'district' => $this->faker->address(),
|
||||
'address' => $this->faker->address(),
|
||||
'home' => $this->faker->address(),
|
||||
'area' => $this->faker->randomElement([62, 79, 86, 105, 150, 300]),
|
||||
'overall_area' => $this->faker->randomElement([62, 79, 86, 105, 150, 300]),
|
||||
'usefull_area' => $this->faker->randomElement([62, 79, 86, 105, 150, 300]),
|
||||
'live_area' => $this->faker->randomElement([62, 79, 86, 105, 150, 300]),
|
||||
'diller_id' => User::select('id')
|
||||
->where('role', RoleEnum::APPRAISER->name)
|
||||
->value('id'),
|
||||
//AAF № 3004735 выдан CHILONZOR TRIB от 19.06.2021 года
|
||||
'tech_passport' => "AAF № " . $this->faker->numberBetween(3004735, 3104735) . " выдан " . $this->faker->address() . " от " . $this->faker->date('Y-m-d') . " года",
|
||||
'tech_given_date' => $this->faker->date('d-m-Y'),
|
||||
'tech_given_whom' => $this->faker->address(),
|
||||
'cost' => $this->faker->numberBetween(100000, 100000000),
|
||||
'note' => $this->faker->sentence(10),
|
||||
'status' => $this->faker->randomElement([
|
||||
OrderStatusEnum::DRAFT->name,
|
||||
OrderStatusEnum::STARTED->name,
|
||||
OrderStatusEnum::FINISHED->name,
|
||||
OrderStatusEnum::APPROVED->name,
|
||||
OrderStatusEnum::REJECTED->name
|
||||
])
|
||||
];
|
||||
}
|
||||
}
|
||||
24
database/factories/OrderMembersFactory.php
Executable file
24
database/factories/OrderMembersFactory.php
Executable file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Model>
|
||||
*/
|
||||
class OrderMembersFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'user_id' => 1,
|
||||
'order_id' => 2
|
||||
];
|
||||
}
|
||||
}
|
||||
22
database/factories/PurposeFactory.php
Executable file
22
database/factories/PurposeFactory.php
Executable file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Purpose>
|
||||
*/
|
||||
class PurposeFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
];
|
||||
}
|
||||
}
|
||||
23
database/factories/SertificateFactory.php
Executable file
23
database/factories/SertificateFactory.php
Executable file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Certificate>
|
||||
*/
|
||||
class SertificateFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
46
database/factories/UserFactory.php
Executable file
46
database/factories/UserFactory.php
Executable file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\RoleEnum;
|
||||
use Exception;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->userName(),
|
||||
'phone' => '+9989' .'-'. $this->faker->numberBetween(0, 1) . '-' . $this->faker->numberBetween(000, 999) . '-' . $this->faker->numberBetween(00, 99) . '-' . $this->faker->numberBetween(00, 99),
|
||||
'email_verified_at' => now(),
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||
'remember_token' => Str::random(10),
|
||||
'avatar' => '/assets/images/users/avatar-' . $this->faker->numberBetween(1, 10) . '.jpg',
|
||||
'role' => $this->faker->randomElement([
|
||||
"APPRAISER","DILLER","USER"]),
|
||||
'status' => $this->faker->randomElement(['active', 'inactive'])
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*
|
||||
* @return Factory
|
||||
*/
|
||||
public function unverified(): Factory
|
||||
{
|
||||
return $this->state(function (array $attributes) {
|
||||
return [
|
||||
'email_verified_at' => null,
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
||||
45
database/migrations/2014_10_12_000000_create_users_table.php
Executable file
45
database/migrations/2014_10_12_000000_create_users_table.php
Executable file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\RoleEnum;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('phone')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->text('avatar');
|
||||
$table->rememberToken();
|
||||
$table->string('status', 10)->default('inactive');
|
||||
$table->string('role', 15)->nullable(true)->default(RoleEnum::USER->name);
|
||||
$table->bigInteger('balance')->default(0);
|
||||
$table->dateTime('last_login')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
User::create(['name' => 'admin', 'phone' => '+998-99-208-08-02', 'password' => Hash::make('123456'), 'email_verified_at' => '2022-01-02 17:04:58', 'avatar' => '/assets/images/users/avatar-5.jpg', 'created_at' => now(), 'role' => 'admin']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
}
|
||||
32
database/migrations/2014_10_12_100000_create_password_resets_table.php
Executable file
32
database/migrations/2014_10_12_100000_create_password_resets_table.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePasswordResetsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('password_resets', function (Blueprint $table) {
|
||||
$table->string('phone')->index();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('password_resets');
|
||||
}
|
||||
}
|
||||
36
database/migrations/2019_08_19_000000_create_failed_jobs_table.php
Executable file
36
database/migrations/2019_08_19_000000_create_failed_jobs_table.php
Executable file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateFailedJobsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePersonalAccessTokensTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->morphs('tokenable');
|
||||
$table->string('name');
|
||||
$table->string('token', 64)->unique();
|
||||
$table->text('abilities')->nullable();
|
||||
$table->timestamp('last_used_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('personal_access_tokens');
|
||||
}
|
||||
}
|
||||
72
database/migrations/2022_12_02_161735_create_auto_order.php
Executable file
72
database/migrations/2022_12_02_161735_create_auto_order.php
Executable file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
// DB::statement("create sequence if not exists order_number_seq start 1001 increment 1");
|
||||
Schema::create('auto_orders', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string("number");
|
||||
// $table->foreignId("diller_id")->references('id')->on('users');
|
||||
$table->bigInteger("diller_id")->nullable();
|
||||
|
||||
$table->string("ordered_customer")->nullable();
|
||||
$table->string("ordered_customer_phone")->nullable();
|
||||
|
||||
$table->string("purpose");
|
||||
$table->string("car_mark");
|
||||
$table->string("car_category");
|
||||
$table->string("car_subcategory");
|
||||
|
||||
$table->bigInteger("cost", false,)->comment("cost of service");
|
||||
$table->string("note", 1024)->nullable();
|
||||
|
||||
$table->bigInteger("price", false, true)->nullable()->comment("paid by customer summ");
|
||||
$table->string("price_note", 1024)->nullable()->comment("note on time evaluate order");
|
||||
$table->string("status");
|
||||
$table->string('customer_first_name')->nullable()->comment("null when customer is juridical");
|
||||
$table->string('customer_last_name')->nullable()->comment("null when customer is juridical");
|
||||
$table->string('customer_patronymic')->nullable()->comment("null when customer is juridical");
|
||||
$table->string('customer_company')->nullable()->comment("null when customer is physical");
|
||||
$table->string('customer_type');
|
||||
|
||||
$table->string('owner_first_name')->nullable()->comment("null when owner is juridical");
|
||||
$table->string('owner_last_name')->nullable()->comment("null when owner is juridical");
|
||||
$table->string('owner_patronymic')->nullable()->comment("null when owner is juridical");
|
||||
$table->string('owner_company')->nullable()->comment("null when owner is physical");
|
||||
$table->string('owner_type');
|
||||
|
||||
$table->string('car_number');
|
||||
$table->string('body');
|
||||
$table->string('engine');
|
||||
$table->string('color')->nullable();
|
||||
$table->string('tech_passport')->nullable();
|
||||
$table->string('tech_given_date')->nullable();
|
||||
$table->string('tech_given_whom')->nullable();
|
||||
$table->string('type');
|
||||
$table->string('shassi');
|
||||
$table->string('made_date');
|
||||
$table->bigInteger('object_price')->nullable()->comment("order evaluated price");
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('auto_orders');
|
||||
}
|
||||
};
|
||||
38
database/migrations/2022_12_04_195612_create_files_table.php
Executable file
38
database/migrations/2022_12_04_195612_create_files_table.php
Executable file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('files', function (Blueprint $table) {
|
||||
$table->uuid('id')->unique();
|
||||
$table->string('path');
|
||||
$table->string('extension', 5);
|
||||
$table->integer('order_id');
|
||||
$table->string('type')->default('ALL');
|
||||
$table->string('name')->default('File uploaded');
|
||||
$table->string('size')->default(1);
|
||||
$table->bigInteger('size_in_bytes')->default(0);
|
||||
$table->string('order_type')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('files');
|
||||
}
|
||||
};
|
||||
34
database/migrations/2022_12_06_201038_create_order_members.php
Executable file
34
database/migrations/2022_12_06_201038_create_order_members.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('order_members', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('order_id');
|
||||
$table->integer('user_id');
|
||||
$table->string('note')->nullable();
|
||||
$table->string('order_type')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('order_members');
|
||||
}
|
||||
};
|
||||
38
database/migrations/2022_12_07_132103_create_tracking_actions.php
Executable file
38
database/migrations/2022_12_07_132103_create_tracking_actions.php
Executable file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('tracking_actions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->references('id')->on('users')->nullable();
|
||||
$table->bigInteger('order_id')->nullable();
|
||||
$table->string('images')->nullable();
|
||||
$table->string('msg');
|
||||
$table->text('params');
|
||||
$table->string('type');
|
||||
$table->string('order_type')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('tracking_actions');
|
||||
}
|
||||
};
|
||||
39
database/migrations/2022_12_17_230357_create_debit_table.php
Executable file
39
database/migrations/2022_12_17_230357_create_debit_table.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Debit;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('debits', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('appraiser_id')->references('id')->on('users');
|
||||
$table->bigInteger('order_id')->nullable();
|
||||
$table->bigInteger("cost", false, true);
|
||||
$table->string('customer');
|
||||
$table->string('expired');
|
||||
$table->string('order_type')->nullable();
|
||||
$table->string('status')->default(Debit::$NOPAID);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('debits');
|
||||
}
|
||||
};
|
||||
34
database/migrations/2022_12_25_104357_create_bonus.php
Executable file
34
database/migrations/2022_12_25_104357_create_bonus.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('bonuses', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->bigInteger('order_id')->nullable();
|
||||
$table->foreignId('appraiser_id')->references('id')->on('users');
|
||||
$table->bigInteger('amount')->default(0);
|
||||
$table->string('order_type')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('bonuses');
|
||||
}
|
||||
};
|
||||
33
database/migrations/2023_01_21_192125_create_certificates_table.php
Executable file
33
database/migrations/2023_01_21_192125_create_certificates_table.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('certificates', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('type')->nullable(false);
|
||||
$table->string('path')->nullable(false);
|
||||
$table->tinyInteger('sort')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('certificates');
|
||||
}
|
||||
};
|
||||
69
database/migrations/2023_02_13_025835_create_estate_orders.php
Executable file
69
database/migrations/2023_02_13_025835_create_estate_orders.php
Executable file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('estate_orders', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string("number");
|
||||
$table->bigInteger("diller_id")->nullable();
|
||||
$table->string("ordered_customer")->nullable();
|
||||
$table->string("ordered_customer_phone")->nullable();
|
||||
|
||||
$table->string("purpose");
|
||||
$table->bigInteger("cost", false)->comment("cost of service");
|
||||
$table->string("note", 1024)->nullable();
|
||||
|
||||
$table->bigInteger("price", false, true)->nullable()->comment("paid by customer summ");
|
||||
$table->string("price_note", 1024)->nullable()->comment("note on time evaluate order");
|
||||
$table->string("status");
|
||||
$table->string('customer_first_name')->nullable()->comment("null when customer is juridical");
|
||||
$table->string('customer_last_name')->nullable()->comment("null when customer is juridical");
|
||||
$table->string('customer_patronymic')->nullable()->comment("null when customer is juridical");
|
||||
$table->string('customer_company')->nullable()->comment("null when customer is physical");
|
||||
$table->string('customer_type');
|
||||
|
||||
$table->string('owner_first_name')->nullable()->comment("null when owner is juridical");
|
||||
$table->string('owner_last_name')->nullable()->comment("null when owner is juridical");
|
||||
$table->string('owner_patronymic')->nullable()->comment("null when owner is juridical");
|
||||
$table->string('owner_company')->nullable()->comment("null when owner is physical");
|
||||
$table->string('owner_type');
|
||||
|
||||
$table->string('contract_date');
|
||||
$table->string('name_of_object');
|
||||
$table->string('address');
|
||||
$table->string('region');
|
||||
$table->string('district');
|
||||
$table->string('home');
|
||||
$table->string('area')->nullable();
|
||||
$table->string('overall_area')->nullable();
|
||||
$table->string('usefull_area')->nullable();
|
||||
$table->string('live_area')->nullable();
|
||||
$table->string('tech_given_date')->nullable();
|
||||
$table->string('tech_passport')->nullable();
|
||||
$table->string('tech_given_whom')->nullable();
|
||||
|
||||
$table->bigInteger('object_price')->nullable()->comment("order evaluated price");
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('estate_orders');
|
||||
}
|
||||
};
|
||||
41
database/migrations/2023_02_19_153612_creare_user_info.php
Executable file
41
database/migrations/2023_02_19_153612_creare_user_info.php
Executable file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('user_infos', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->references('id')->on('users');
|
||||
$table->string('first_name');
|
||||
$table->string('last_name');
|
||||
$table->string('email');
|
||||
$table->text('description');
|
||||
$table->string('address');
|
||||
$table->string('cover');
|
||||
$table->string('skills');
|
||||
$table->string('company');
|
||||
$table->float('completed');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('user_infos');
|
||||
}
|
||||
};
|
||||
33
database/migrations/2023_03_26_094031_create_purposes_table.php
Executable file
33
database/migrations/2023_03_26_094031_create_purposes_table.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('purposes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uz');
|
||||
$table->string('ru');
|
||||
$table->string('cr');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('purposes');
|
||||
}
|
||||
};
|
||||
34
database/migrations/2023_03_26_133103_create_regions_table.php
Executable file
34
database/migrations/2023_03_26_133103_create_regions_table.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uz');
|
||||
$table->string('ru');
|
||||
$table->string('cr');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regions');
|
||||
}
|
||||
};
|
||||
34
database/migrations/2023_03_26_133113_create_districts_table.php
Executable file
34
database/migrations/2023_03_26_133113_create_districts_table.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('districts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uz');
|
||||
$table->string('ru');
|
||||
$table->string('cr');
|
||||
$table->integer('region_id');//->references('id')->on('region');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('districts');
|
||||
}
|
||||
};
|
||||
34
database/migrations/2023_03_26_185533_create_concerns_table.php
Executable file
34
database/migrations/2023_03_26_185533_create_concerns_table.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('concerns', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uz');
|
||||
$table->string('ru');
|
||||
$table->string('cr');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('concerns');
|
||||
}
|
||||
};
|
||||
21
database/seeders/AutoOrderSeeder.php
Executable file
21
database/seeders/AutoOrderSeeder.php
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\AutoOrder;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class AutoOrderSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
AutoOrder::factory()
|
||||
->count(30)
|
||||
->create();
|
||||
}
|
||||
}
|
||||
22
database/seeders/DatabaseSeeder.php
Executable file
22
database/seeders/DatabaseSeeder.php
Executable file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->call([
|
||||
UserSeeder::class,
|
||||
AutoOrderSeeder::class,
|
||||
EstateOrderSeeder::class
|
||||
]);
|
||||
}
|
||||
}
|
||||
21
database/seeders/EstateOrderSeeder.php
Executable file
21
database/seeders/EstateOrderSeeder.php
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\EstateOrder;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class EstateOrderSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
EstateOrder::factory()
|
||||
->count(30)
|
||||
->create();
|
||||
}
|
||||
}
|
||||
19
database/seeders/FileSeeder.php
Executable file
19
database/seeders/FileSeeder.php
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class FileSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
21
database/seeders/PurposeSeeder.php
Executable file
21
database/seeders/PurposeSeeder.php
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Purpose;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PurposeSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Purpose::factory()
|
||||
->count(5)
|
||||
->create();
|
||||
}
|
||||
}
|
||||
19
database/seeders/SertificateSeeder.php
Executable file
19
database/seeders/SertificateSeeder.php
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SertificateSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
22
database/seeders/UserSeeder.php
Executable file
22
database/seeders/UserSeeder.php
Executable file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\AutoOrder;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class UserSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
User::factory()
|
||||
->count(30)
|
||||
->create();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user