[Updated: customer_group event and Models mappings.]
This commit is contained in:
parent
7fde43011d
commit
be1d10248c
|
|
@ -88,6 +88,15 @@ class AddressDataGrid extends DataGrid
|
|||
*/
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'address_id',
|
||||
'label' => trans('admin::app.datagrid.id'),
|
||||
'type' => 'number',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'company_name',
|
||||
'label' => trans('admin::app.customers.addresses.company-name'),
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Webkul\Admin\Http\Controllers\Customer;
|
||||
|
||||
use Webkul\Admin\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Customer\Repositories\CustomerGroupRepository;
|
||||
|
||||
class CustomerGroupController extends Controller
|
||||
|
|
@ -72,7 +73,11 @@ class CustomerGroupController extends Controller
|
|||
|
||||
$data['is_user_defined'] = 1;
|
||||
|
||||
$this->customerGroupRepository->create($data);
|
||||
Event::dispatch('customer.customer_group.create.before');
|
||||
|
||||
$customerGroup = $this->customerGroupRepository->create($data);
|
||||
|
||||
Event::dispatch('customer.customer_group.create.after', $customerGroup);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Customer Group']));
|
||||
|
||||
|
|
@ -105,7 +110,11 @@ class CustomerGroupController extends Controller
|
|||
'name' => 'required',
|
||||
]);
|
||||
|
||||
$this->customerGroupRepository->update(request()->all(), $id);
|
||||
Event::dispatch('customer.customer_group.update.before', $id);
|
||||
|
||||
$customerGroup = $this->customerGroupRepository->update(request()->all(), $id);
|
||||
|
||||
Event::dispatch('customer.customer_group.update.after', $customerGroup);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Customer Group']));
|
||||
|
||||
|
|
@ -128,8 +137,12 @@ class CustomerGroupController extends Controller
|
|||
session()->flash('warning', trans('admin::app.response.customer-associate', ['name' => 'Customer Group']));
|
||||
} else {
|
||||
try {
|
||||
Event::dispatch('customer.customer_group.delete.before', $id);
|
||||
|
||||
$this->customerGroupRepository->delete($id);
|
||||
|
||||
Event::dispatch('customer.customer_group.delete.after', $id);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Customer Group']));
|
||||
|
||||
return response()->json(['message' => true], 200);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,11 @@
|
|||
<form method="post" action="{{ route('admin.customer.addresses.update', $address->id) }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.customers.addresses.edit-title') }}</h1>
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.customer.addresses.index', ['id' => $address->customer_id]) }}'"></i>
|
||||
|
||||
{{ __('admin::app.customers.addresses.edit-title') }}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
|
|
|
|||
|
|
@ -8,7 +8,11 @@
|
|||
<div class="content">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.customers.addresses.title', ['customer_name' => $customer->first_name . ' ' . $customer->last_name]) }}</h1>
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.customer.edit', ['id' => $customer->id]) }}'"></i>
|
||||
|
||||
{{ __('admin::app.customers.addresses.title', ['customer_name' => $customer->first_name . ' ' . $customer->last_name]) }}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Webkul\BookingProduct\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Webkul\Product\Models\ProductProxy;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Webkul\BookingProduct\Database\Factories\BookingProductFactory;
|
||||
use Webkul\BookingProduct\Contracts\BookingProduct as BookingProductContract;
|
||||
|
|
@ -84,4 +85,12 @@ class BookingProduct extends Model implements BookingProductContract
|
|||
{
|
||||
return BookingProductFactory::new();
|
||||
}
|
||||
|
||||
/**
|
||||
* The Product belong to the product booking.
|
||||
*/
|
||||
public function product(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(ProductProxy::modelClass());
|
||||
}
|
||||
}
|
||||
|
|
@ -31,6 +31,14 @@ class CartRuleCoupon extends Model implements CartRuleCouponContract
|
|||
return $this->belongsTo(CartRuleProxy::modelClass());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cart rule that owns the cart rule coupon.
|
||||
*/
|
||||
public function coupon_usage()
|
||||
{
|
||||
return $this->hasMany(CartRuleCouponUsageProxy::modelClass());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new factory instance for the model
|
||||
*
|
||||
|
|
|
|||
|
|
@ -42,4 +42,20 @@ class CatalogRule extends Model implements CatalogRuleContract
|
|||
{
|
||||
return $this->belongsToMany(CustomerGroupProxy::modelClass(), 'catalog_rule_customer_groups');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Catalog rule Product that owns the catalog rule.
|
||||
*/
|
||||
public function catalog_rule_products()
|
||||
{
|
||||
return $this->hasMany(CatalogRuleProductProxy::modelClass());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Catalog rule Product that owns the catalog rule.
|
||||
*/
|
||||
public function catalog_rule_product_prices()
|
||||
{
|
||||
return $this->hasMany(CatalogRuleProductPriceProxy::modelClass());
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,9 @@
|
|||
namespace Webkul\CatalogRule\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Webkul\Product\Models\ProductProxy;
|
||||
use Webkul\Core\Models\ChannelProxy;
|
||||
use Webkul\Customer\Models\CustomerGroupProxy;
|
||||
use Webkul\CatalogRule\Contracts\CatalogRuleProduct as CatalogRuleProductContract;
|
||||
|
||||
class CatalogRuleProduct extends Model implements CatalogRuleProductContract
|
||||
|
|
@ -21,4 +24,36 @@ class CatalogRuleProduct extends Model implements CatalogRuleProductContract
|
|||
'customer_group_id',
|
||||
'product_id',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the Catalog Rule that owns the catalog rule.
|
||||
*/
|
||||
public function catalog_rule()
|
||||
{
|
||||
return $this->belongsTo(CatalogRuleProxy::modelClass(), 'catalog_rule_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Product that owns the catalog rule.
|
||||
*/
|
||||
public function product()
|
||||
{
|
||||
return $this->belongsTo(ProductProxy::modelClass(), 'product_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channels that owns the catalog rule.
|
||||
*/
|
||||
public function channel()
|
||||
{
|
||||
return $this->belongsTo(ChannelProxy::modelClass(), 'channel_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the customer groups that owns the catalog rule.
|
||||
*/
|
||||
public function customer_group()
|
||||
{
|
||||
return $this->belongsTo(CustomerGroupProxy::modelClass(), 'customer_group_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -12,4 +12,12 @@ class Country extends TranslatableModel implements CountryContract
|
|||
public $translatedAttributes = ['name'];
|
||||
|
||||
protected $with = ['translations'];
|
||||
|
||||
/**
|
||||
* Get the States.
|
||||
*/
|
||||
public function states()
|
||||
{
|
||||
return $this->hasMany(CountryStateProxy::modelClass());
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Webkul\Core\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Webkul\Core\Contracts\CurrencyExchangeRate as CurrencyExchangeRateContract;
|
||||
|
||||
class CurrencyExchangeRate extends Model implements CurrencyExchangeRateContract
|
||||
|
|
@ -16,4 +17,12 @@ class CurrencyExchangeRate extends Model implements CurrencyExchangeRateContract
|
|||
'target_currency',
|
||||
'rate',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the exchange rate associated with the currency.
|
||||
*/
|
||||
public function currency(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(CurrencyProxy::modelClass(), 'target_currency');
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Webkul\Core\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Webkul\Core\Contracts\Slider as SliderContract;
|
||||
|
||||
|
|
@ -60,4 +61,12 @@ class Slider extends Model implements SliderContract
|
|||
{
|
||||
return $this->image_url();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the slider channel name associated with the channel.
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(ChannelProxy::modelClass());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|||
use Webkul\Product\Contracts\Product as ProductContract;
|
||||
use Webkul\Product\Database\Eloquent\Builder;
|
||||
use Webkul\Product\Type\AbstractType;
|
||||
use Webkul\BookingProduct\Models\BookingProductProxy;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class Product extends Model implements ProductContract
|
||||
|
|
@ -539,4 +540,12 @@ class Product extends Model implements ProductContract
|
|||
{
|
||||
return ProductFactory::new();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the booking that owns the product.
|
||||
*/
|
||||
public function booking_product()
|
||||
{
|
||||
return $this->hasOne(BookingProductProxy::modelClass());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,27 @@
|
|||
namespace Webkul\Velocity\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Webkul\Product\Models\ProductFlatProxy;
|
||||
use Webkul\Customer\Models\CustomerProxy;
|
||||
use Webkul\Velocity\Contracts\VelocityCustomerCompareProduct as VelocityCustomerCompareProductContract;
|
||||
|
||||
class VelocityCustomerCompareProduct extends Model implements VelocityCustomerCompareProductContract
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* The product_flat that belong to the compare product.
|
||||
*/
|
||||
public function product_flat()
|
||||
{
|
||||
return $this->belongsTo(ProductFlatProxy::modelClass(), 'product_flat_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* The customer that belong to the compare product.
|
||||
*/
|
||||
public function customer()
|
||||
{
|
||||
return $this->belongsTo(CustomerProxy::modelClass(), 'customer_id');
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue