Create routes and views for customers and their addresses.

This commit is contained in:
2024-12-10 21:09:12 +01:00
parent 9d2eddbcf1
commit 679a067506
16 changed files with 797 additions and 3 deletions

View File

@@ -12,7 +12,7 @@ return new class extends Migration {
{
Schema::create('addresses', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained();
$table->foreignId('customer_id')->constrained();
$table->string('name');
$table->string('email')->nullable();

View File

@@ -0,0 +1,29 @@
<?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::table('addresses', function (Blueprint $table) {
$table->boolean('is_address')->default(false)->after('customer_id');
$table->boolean('is_delivery')->default(false)->after('is_address');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('addresses', function (Blueprint $table) {
$table->dropColumn('is_address');
$table->dropColumn('is_delivery');
});
}
};