diff --git a/app/Address.php b/app/Address.php index 79e3ae3f..cf92eefa 100644 --- a/app/Address.php +++ b/app/Address.php @@ -4,8 +4,6 @@ namespace Crater; use Illuminate\Database\Eloquent\Model; use Crater\User; use Crater\Country; -use Crater\State; -use Crater\City; class Address extends Model { @@ -16,8 +14,8 @@ class Address extends Model 'name', 'address_street_1', 'address_street_2', - 'city_id', - 'state_id', + 'city', + 'state', 'country_id', 'zip', 'phone', @@ -35,14 +33,4 @@ class Address extends Model { return $this->belongsTo(Country::class); } - - public function state() - { - return $this->belongsTo(State::class); - } - - public function city() - { - return $this->belongsTo(City::class); - } } diff --git a/app/Country.php b/app/Country.php index 8a7b9acb..be3e962b 100644 --- a/app/Country.php +++ b/app/Country.php @@ -2,15 +2,9 @@ namespace Crater; use Illuminate\Database\Eloquent\Model; -use Crater\State; class Country extends Model { - public function states() - { - return $this->hasMany(State::class); - } - public function address() { return $this->hasMany(Address::class); diff --git a/app/Http/Controllers/CompanyController.php b/app/Http/Controllers/CompanyController.php index 571536d0..a26ad328 100644 --- a/app/Http/Controllers/CompanyController.php +++ b/app/Http/Controllers/CompanyController.php @@ -56,7 +56,7 @@ class CompanyController extends Controller public function getAdminCompany() { - $user = User::with(['addresses', 'addresses.country', 'addresses.state', 'addresses.city', 'company'])->find(1); + $user = User::with(['addresses', 'addresses.country', 'company'])->find(1); return response()->json([ 'user' => $user @@ -75,9 +75,9 @@ class CompanyController extends Controller $company->addMediaFromRequest('logo')->toMediaCollection('logo'); } - $fields = $request->only(['address_street_1', 'address_street_2', 'city_id', 'state_id', 'country_id', 'zip', 'phone']); + $fields = $request->only(['address_street_1', 'address_street_2', 'city', 'state', 'country_id', 'zip', 'phone']); $address = Address::updateOrCreate(['user_id' => 1], $fields); - $user = User::with(['addresses', 'addresses.country', 'addresses.state', 'addresses.city', 'company'])->find(1); + $user = User::with(['addresses', 'addresses.country', 'company'])->find(1); return response()->json([ 'user' => $user, diff --git a/app/Http/Controllers/CustomersController.php b/app/Http/Controllers/CustomersController.php index 79fc1d57..d31bf66d 100644 --- a/app/Http/Controllers/CustomersController.php +++ b/app/Http/Controllers/CustomersController.php @@ -80,8 +80,8 @@ class CustomersController extends Controller $newAddress->name = $address["name"]; $newAddress->address_street_1 = $address["address_street_1"]; $newAddress->address_street_2 = $address["address_street_2"]; - $newAddress->city_id = $address["city_id"]; - $newAddress->state_id = $address["state_id"]; + $newAddress->city = $address["city"]; + $newAddress->state = $address["state"]; $newAddress->country_id = $address["country_id"]; $newAddress->zip = $address["zip"]; $newAddress->phone = $address["phone"]; @@ -187,8 +187,8 @@ class CustomersController extends Controller $newAddress->name = $address["name"]; $newAddress->address_street_1 = $address["address_street_1"]; $newAddress->address_street_2 = $address["address_street_2"]; - $newAddress->city_id = $address["city_id"]; - $newAddress->state_id = $address["state_id"]; + $newAddress->city = $address["city"]; + $newAddress->state = $address["state"]; $newAddress->country_id = $address["country_id"]; $newAddress->zip = $address["zip"]; $newAddress->phone = $address["phone"]; diff --git a/app/Http/Controllers/FrontendController.php b/app/Http/Controllers/FrontendController.php index 66c6b33b..fdbf55bd 100644 --- a/app/Http/Controllers/FrontendController.php +++ b/app/Http/Controllers/FrontendController.php @@ -90,7 +90,7 @@ class FrontendController extends Controller } } - $companyAddress = User::with(['addresses', 'addresses.country', 'addresses.state', 'addresses.city'])->find(1); + $companyAddress = User::with(['addresses', 'addresses.country'])->find(1); $colors = [ 'invoice_primary_color', @@ -189,7 +189,7 @@ class FrontendController extends Controller } } - $companyAddress = User::with(['addresses', 'addresses.country', 'addresses.state', 'addresses.city'])->find(1); + $companyAddress = User::with(['addresses', 'addresses.country'])->find(1); $colors = [ 'invoice_primary_color', @@ -262,7 +262,7 @@ class FrontendController extends Controller $estimateTemplate = EstimateTemplate::find($estimate->estimate_template_id); $company = Company::find($estimate->company_id); - $companyAddress = User::with(['addresses', 'addresses.country', 'addresses.state', 'addresses.city'])->find(1); + $companyAddress = User::with(['addresses', 'addresses.country'])->find(1); $logo = $company->getMedia('logo')->first(); if($logo) { @@ -338,7 +338,7 @@ class FrontendController extends Controller $invoiceTemplate = InvoiceTemplate::find($invoice->invoice_template_id); $company = Company::find($invoice->company_id); - $companyAddress = User::with(['addresses', 'addresses.country', 'addresses.state', 'addresses.city'])->find(1); + $companyAddress = User::with(['addresses', 'addresses.country'])->find(1); $logo = $company->getMedia('logo')->first(); diff --git a/app/Http/Controllers/LocationController.php b/app/Http/Controllers/LocationController.php index 1183c840..e4234cdf 100644 --- a/app/Http/Controllers/LocationController.php +++ b/app/Http/Controllers/LocationController.php @@ -3,8 +3,6 @@ namespace Crater\Http\Controllers; use Illuminate\Http\Request; use Crater\Country; -use Crater\State; -use Crater\City; class LocationController extends Controller { @@ -14,18 +12,4 @@ class LocationController extends Controller 'countries' => Country::all() ]); } - - public function getStates($id) - { - return response()->json([ - 'states' => Country::find($id)->states - ]); - } - - public function getCities($id) - { - return response()->json([ - 'cities' => State::find($id)->cities - ]); - } } diff --git a/app/Http/Controllers/OnboardingController.php b/app/Http/Controllers/OnboardingController.php index d6e55620..2eb8bb94 100644 --- a/app/Http/Controllers/OnboardingController.php +++ b/app/Http/Controllers/OnboardingController.php @@ -58,8 +58,6 @@ class OnboardingController extends Controller $user = User::with([ 'addresses', 'addresses.country', - 'addresses.state', - 'addresses.city', 'company' ])->find(1); @@ -156,8 +154,8 @@ class OnboardingController extends Controller $fields = $request->only([ 'address_street_1', 'address_street_2', - 'city_id', - 'state_id', + 'city', + 'state', 'country_id', 'zip', 'phone' diff --git a/app/Listeners/Updates/v2/Version200.php b/app/Listeners/Updates/v2/Version200.php new file mode 100644 index 00000000..7d3ebc79 --- /dev/null +++ b/app/Listeners/Updates/v2/Version200.php @@ -0,0 +1,110 @@ +isListenerFired($event)) { + return; + } + + // Replace state and city id to name + $this->replaceStateAndCityName(); + + // Drop states and cities foreign key + $this->dropForeignKey(); + + // Remove states and cities tables + $this->dropSchemas(); + + // Delete state & city models, migrations & seeders + $this->deleteFiles(); + + // Update Crater app version + $this->updateVersion(); + } + + private function replaceStateAndCityName() { + \Schema::table('addresses', function (Blueprint $table) { + $table->string('state')->nullable(); + $table->string('city')->nullable(); + }); + + $addresses = \Crater\Address::all(); + foreach ($addresses as $add) { + $city = \Crater\City::find($add->city_id); + if($city) { + $add->city = $city->name; + } + + $state = \Crater\State::find($add->state_id); + if($state) { + $add->state = $state->name; + } + + $add->save(); + } + } + + private function dropForeignKey() { + \Schema::table('addresses', function (Blueprint $table) { + $table->dropForeign('addresses_state_id_foreign'); + $table->dropForeign('addresses_city_id_foreign'); + $table->dropColumn('state_id'); + $table->dropColumn('city_id'); + }); + } + + private function dropSchemas() { + \Schema::disableForeignKeyConstraints(); + + \Schema::dropIfExists('states'); + \Schema::dropIfExists('cities'); + + \Schema::enableForeignKeyConstraints(); + } + + private function deleteFiles() { + \File::delete( + database_path('migrations/2017_05_06_172817_create_cities_table.php'), + database_path('migrations/2017_05_06_173711_create_states_table.php'), + database_path('seeds/StatesTableSeeder.php'), + database_path('seeds/CitiesTableSeeder.php'), + app_path('City.php'), + app_path('State.php') + ); + } + + private function updateVersion() { + Setting::setSetting('version', static::VERSION); + } +} diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 78028330..840fdde5 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -6,6 +6,7 @@ use Illuminate\Auth\Events\Registered; use Illuminate\Auth\Listeners\SendEmailVerificationNotification; use Crater\Events\UpdateFinished; use Crater\Listeners\Updates\v1\Version110; +use Crater\Listeners\Updates\v2\Version200; class EventServiceProvider extends ServiceProvider { @@ -17,6 +18,7 @@ class EventServiceProvider extends ServiceProvider protected $listen = [ UpdateFinished::class=> [ Version110::class, + Version200::class, ], Registered::class => [ SendEmailVerificationNotification::class, diff --git a/composer.json b/composer.json index 3c13532f..31db82c7 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,7 @@ "require": { "php": "^7.2", "barryvdh/laravel-dompdf": "^0.8.1", + "doctrine/dbal": "^2.10", "fideloper/proxy": "^4.0", "guzzlehttp/guzzle": "^6.3", "intervention/image": "^2.3", diff --git a/composer.lock b/composer.lock index 1a956ae1..ea2e96d5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2a5e8d91a2be3144e2812dd708dc14b7", + "content-hash": "e7cf4f0a8e1e7d60cc72b34ed4c730ce", "packages": [ { "name": "barryvdh/laravel-dompdf", @@ -158,6 +158,247 @@ "description": "implementation of xdg base directory specification for php", "time": "2014-10-24T07:27:01+00:00" }, + { + "name": "doctrine/cache", + "version": "v1.8.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "d4374ae95b36062d02ef310100ed33d78738d76c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/d4374ae95b36062d02ef310100ed33d78738d76c", + "reference": "d4374ae95b36062d02ef310100ed33d78738d76c", + "shasum": "" + }, + "require": { + "php": "~7.1" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "alcaeus/mongo-php-adapter": "^1.1", + "doctrine/coding-standard": "^4.0", + "mongodb/mongodb": "^1.1", + "phpunit/phpunit": "^7.0", + "predis/predis": "~1.0" + }, + "suggest": { + "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Caching library offering an object-oriented API for many cache backends", + "homepage": "https://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ], + "time": "2019-10-28T09:31:32+00:00" + }, + { + "name": "doctrine/dbal", + "version": "v2.10.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/dbal.git", + "reference": "0c9a646775ef549eb0a213a4f9bd4381d9b4d934" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/0c9a646775ef549eb0a213a4f9bd4381d9b4d934", + "reference": "0c9a646775ef549eb0a213a4f9bd4381d9b4d934", + "shasum": "" + }, + "require": { + "doctrine/cache": "^1.0", + "doctrine/event-manager": "^1.0", + "ext-pdo": "*", + "php": "^7.2" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "jetbrains/phpstorm-stubs": "^2019.1", + "phpstan/phpstan": "^0.11.3", + "phpunit/phpunit": "^8.4.1", + "symfony/console": "^2.0.5|^3.0|^4.0|^5.0" + }, + "suggest": { + "symfony/console": "For helpful console commands such as SQL execution and import of files." + }, + "bin": [ + "bin/doctrine-dbal" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.10.x-dev", + "dev-develop": "3.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\DBAL\\": "lib/Doctrine/DBAL" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.", + "homepage": "https://www.doctrine-project.org/projects/dbal.html", + "keywords": [ + "abstraction", + "database", + "db2", + "dbal", + "mariadb", + "mssql", + "mysql", + "oci8", + "oracle", + "pdo", + "pgsql", + "postgresql", + "queryobject", + "sasql", + "sql", + "sqlanywhere", + "sqlite", + "sqlserver", + "sqlsrv" + ], + "time": "2019-11-03T16:50:43+00:00" + }, + { + "name": "doctrine/event-manager", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/event-manager.git", + "reference": "a520bc093a0170feeb6b14e9d83f3a14452e64b3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/a520bc093a0170feeb6b14e9d83f3a14452e64b3", + "reference": "a520bc093a0170feeb6b14e9d83f3a14452e64b3", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "conflict": { + "doctrine/common": "<2.9@dev" + }, + "require-dev": { + "doctrine/coding-standard": "^4.0", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "Doctrine Event Manager component", + "homepage": "https://www.doctrine-project.org/projects/event-manager.html", + "keywords": [ + "event", + "eventdispatcher", + "eventmanager" + ], + "time": "2018-06-11T11:59:03+00:00" + }, { "name": "doctrine/inflector", "version": "v1.3.0", @@ -5307,247 +5548,6 @@ ], "time": "2019-05-27T17:52:04+00:00" }, - { - "name": "doctrine/cache", - "version": "v1.8.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/cache.git", - "reference": "d4374ae95b36062d02ef310100ed33d78738d76c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/d4374ae95b36062d02ef310100ed33d78738d76c", - "reference": "d4374ae95b36062d02ef310100ed33d78738d76c", - "shasum": "" - }, - "require": { - "php": "~7.1" - }, - "conflict": { - "doctrine/common": ">2.2,<2.4" - }, - "require-dev": { - "alcaeus/mongo-php-adapter": "^1.1", - "doctrine/coding-standard": "^4.0", - "mongodb/mongodb": "^1.1", - "phpunit/phpunit": "^7.0", - "predis/predis": "~1.0" - }, - "suggest": { - "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Caching library offering an object-oriented API for many cache backends", - "homepage": "https://www.doctrine-project.org", - "keywords": [ - "cache", - "caching" - ], - "time": "2019-10-28T09:31:32+00:00" - }, - { - "name": "doctrine/dbal", - "version": "v2.10.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/dbal.git", - "reference": "0c9a646775ef549eb0a213a4f9bd4381d9b4d934" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/0c9a646775ef549eb0a213a4f9bd4381d9b4d934", - "reference": "0c9a646775ef549eb0a213a4f9bd4381d9b4d934", - "shasum": "" - }, - "require": { - "doctrine/cache": "^1.0", - "doctrine/event-manager": "^1.0", - "ext-pdo": "*", - "php": "^7.2" - }, - "require-dev": { - "doctrine/coding-standard": "^6.0", - "jetbrains/phpstorm-stubs": "^2019.1", - "phpstan/phpstan": "^0.11.3", - "phpunit/phpunit": "^8.4.1", - "symfony/console": "^2.0.5|^3.0|^4.0|^5.0" - }, - "suggest": { - "symfony/console": "For helpful console commands such as SQL execution and import of files." - }, - "bin": [ - "bin/doctrine-dbal" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.10.x-dev", - "dev-develop": "3.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\DBAL\\": "lib/Doctrine/DBAL" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - } - ], - "description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.", - "homepage": "https://www.doctrine-project.org/projects/dbal.html", - "keywords": [ - "abstraction", - "database", - "db2", - "dbal", - "mariadb", - "mssql", - "mysql", - "oci8", - "oracle", - "pdo", - "pgsql", - "postgresql", - "queryobject", - "sasql", - "sql", - "sqlanywhere", - "sqlite", - "sqlserver", - "sqlsrv" - ], - "time": "2019-11-03T16:50:43+00:00" - }, - { - "name": "doctrine/event-manager", - "version": "v1.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/event-manager.git", - "reference": "a520bc093a0170feeb6b14e9d83f3a14452e64b3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/event-manager/zipball/a520bc093a0170feeb6b14e9d83f3a14452e64b3", - "reference": "a520bc093a0170feeb6b14e9d83f3a14452e64b3", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "conflict": { - "doctrine/common": "<2.9@dev" - }, - "require-dev": { - "doctrine/coding-standard": "^4.0", - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\": "lib/Doctrine/Common" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - }, - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "description": "Doctrine Event Manager component", - "homepage": "https://www.doctrine-project.org/projects/event-manager.html", - "keywords": [ - "event", - "eventdispatcher", - "eventmanager" - ], - "time": "2018-06-11T11:59:03+00:00" - }, { "name": "doctrine/instantiator", "version": "1.2.0", diff --git a/database/factories/AddressFactory.php b/database/factories/AddressFactory.php index 52b3cd37..acf6e904 100644 --- a/database/factories/AddressFactory.php +++ b/database/factories/AddressFactory.php @@ -10,9 +10,9 @@ $factory->define(Address::class, function (Faker $faker) { 'name' => $faker->name, 'address_street_1' => $faker->streetAddress, 'address_street_2' => $faker->streetAddress, - 'city_id' => 5909, - 'state_id' => 42, - 'country_id' => 1, + 'city' => $faker->city, + 'state' => $faker->state, + 'country_id' => 231, 'zip' => $faker->postcode, 'phone' => $faker->phoneNumber, 'fax' => $faker->phoneNumber, diff --git a/database/migrations/2019_08_30_072639_create_addresses_table.php b/database/migrations/2019_08_30_072639_create_addresses_table.php index 6903777d..9870d0eb 100644 --- a/database/migrations/2019_08_30_072639_create_addresses_table.php +++ b/database/migrations/2019_08_30_072639_create_addresses_table.php @@ -18,10 +18,8 @@ class CreateAddressesTable extends Migration $table->string('name')->nullable(); $table->string('address_street_1')->nullable(); $table->string('address_street_2')->nullable(); - $table->integer('city_id')->unsigned()->nullable(); - $table->foreign('city_id')->references('id')->on('cities'); - $table->integer('state_id')->unsigned()->nullable(); - $table->foreign('state_id')->references('id')->on('states'); + $table->string('city')->nullable(); + $table->string('state')->nullable(); $table->integer('country_id')->unsigned()->nullable(); $table->foreign('country_id')->references('id')->on('countries'); $table->string('zip')->nullable(); diff --git a/resources/assets/js/components/base/modal/CustomerModal.vue b/resources/assets/js/components/base/modal/CustomerModal.vue index 33f7386c..1034793b 100644 --- a/resources/assets/js/components/base/modal/CustomerModal.vue +++ b/resources/assets/js/components/base/modal/CustomerModal.vue @@ -163,15 +163,10 @@