Add UserAddress model.
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-08-24 17:58:33 +03:00
parent 66b8373da3
commit 4430b04f11
6 changed files with 135 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\UserAddress>
*/
class UserAddressFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}
@@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('user_addresses', function (Blueprint $table) {
$table->id();
$table->string('title', 100);
$table->smallInteger('type')->default(0);
$table->string('street', 255);
$table->string('house', 10)->nullable();
$table->string('flat', 10)->nullable();
$table->string('stage', 10)->nullable();
$table->string('note', 100);
$table->unsignedBiginteger('city_id')->unsigned();
$table->unsignedBiginteger('user_id')->unsigned();
$table->foreign('city_id')->references('id')
->on('cities')->onDelete('cascade');
$table->foreign('user_id')->references('id')
->on('users')->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('user_addresses');
}
};
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class UserAddressSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}