Merge pull request #2557 from Haendlerbund/company-name-propagation

company_name and vat_id address->cart->order (addresses) fixes
This commit is contained in:
Jitendra Singh 2020-02-26 15:15:21 +05:30 committed by GitHub
commit f0c65fa319
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 79 additions and 2 deletions

View File

@ -212,7 +212,7 @@ class Cart
'items_count' => 1,
];
//Authentication details
// Fill in the customer data, as far as possible:
if ($this->getCurrentCustomer()->check()) {
$cartData['customer_id'] = $this->getCurrentCustomer()->user()->id;
$cartData['is_guest'] = 0;

View File

@ -9,7 +9,21 @@ class CartAddress extends Model implements CartAddressContract
{
protected $table = 'cart_address';
protected $fillable = ['first_name', 'last_name', 'email', 'address1', 'city', 'state', 'postcode', 'country', 'phone', 'address_type', 'cart_id'];
protected $fillable = [
'first_name',
'last_name',
'email',
'company_name',
'vat_id',
'address1',
'city',
'state',
'postcode',
'country',
'phone',
'address_type',
'cart_id',
];
/**
* Get the shipping rates for the cart address.

View File

@ -0,0 +1,45 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class PropagateCompanyName extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cart_address', function (Blueprint $table) {
$table->string('company_name')->nullable()->after('email');
$table->string('vat_id')->nullable()->after('company_name');
});
Schema::table('order_address', function (Blueprint $table) {
$table->string('company_name')->nullable()->after('email');
$table->string('vat_id')->nullable()->after('company_name');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cart_address', function (Blueprint $table) {
$table->dropColumn('company_name');
$table->dropColumn('vat_id');
});
Schema::table('order_address', function (Blueprint $table) {
$table->dropColumn('company_name');
$table->dropColumn('vat_id');
});
}
}

View File

@ -11,6 +11,24 @@ class OrderAddress extends Model implements OrderAddressContract
protected $guarded = ['id', 'created_at', 'updated_at'];
protected $fillable = [
'first_name',
'last_name',
'email',
'company_name',
'vat_id',
'address1',
'address2',
'city',
'state',
'postcode',
'country',
'phone',
'address_type',
'cart_id',
'customer_id',
];
/**
* Get of the customer fullname.
*/