diff --git a/app/Http/Requests/CreateCustomerRequest.php b/app/Http/Requests/CreateCustomerRequest.php index 11d334a..fa3c560 100644 --- a/app/Http/Requests/CreateCustomerRequest.php +++ b/app/Http/Requests/CreateCustomerRequest.php @@ -28,7 +28,8 @@ class CreateCustomerRequest extends FormRequest 'status' => 'nullable|integer|in:0,1,2,3', 'company' => 'nullable', 'phone' => 'nullable', - 'address' => 'nullable', + 'address' => 'nullable|string|max:255', + 'address_2' => 'nullable|string|max:255', 'city' => 'nullable', 'state' => 'nullable', 'postcode' => 'nullable', diff --git a/app/Http/Resources/Api/Admin/CustomerResource.php b/app/Http/Resources/Api/Admin/CustomerResource.php index 6cf5c77..cfaf339 100644 --- a/app/Http/Resources/Api/Admin/CustomerResource.php +++ b/app/Http/Resources/Api/Admin/CustomerResource.php @@ -16,6 +16,12 @@ class CustomerResource extends JsonResource 'email' => $this->email, 'phone' => $this->phone, 'company' => $this->company, + 'address' => $this->address, + 'address_2' => $this->address_2, + 'city' => $this->city, + 'state' => $this->state, + 'postcode' => $this->postcode === null ? null : (string) $this->postcode, + 'country' => $this->country, 'note' => $this->note, 'status' => (int) $this->status, 'total' => (int) $this->total, diff --git a/app/Models/Customer.php b/app/Models/Customer.php index 5fd3abc..5415133 100644 --- a/app/Models/Customer.php +++ b/app/Models/Customer.php @@ -52,6 +52,7 @@ class Customer extends Authenticatable implements JWTSubject 'username', 'avatar', 'address', + 'address_2', 'state', 'city', 'postcode', diff --git a/database/migrations/2026_10_27_000001_add_address_2_to_customers_table.php b/database/migrations/2026_10_27_000001_add_address_2_to_customers_table.php new file mode 100644 index 0000000..bc2bc72 --- /dev/null +++ b/database/migrations/2026_10_27_000001_add_address_2_to_customers_table.php @@ -0,0 +1,24 @@ +string('address', 255)->nullable()->change(); + $table->string('address_2', 255)->nullable()->after('address'); + }); + } + + public function down(): void + { + Schema::table('customers', function (Blueprint $table) { + $table->dropColumn('address_2'); + $table->string('address', 100)->nullable()->change(); + }); + } +};