Improved customer package code style
This commit is contained in:
parent
5fb33d4fc9
commit
9e7e939479
|
|
@ -36,14 +36,15 @@ class Wishlist
|
|||
|
||||
if (auth()->guard('customer')->user()) {
|
||||
$wishlist = $this->wishlistRepository->findOneWhere([
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'product_id' => $product->product_id,
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'product_id' => $product->product_id,
|
||||
'customer_id' => auth()->guard('customer')->user()->id
|
||||
]);
|
||||
}
|
||||
|
||||
if ($wishlist)
|
||||
if ($wishlist) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,8 +182,9 @@ class AddressController extends Controller
|
|||
*/
|
||||
public function makeDefault($id)
|
||||
{
|
||||
if ($default = $this->customer->default_address)
|
||||
if ($default = $this->customer->default_address) {
|
||||
$this->customerAddressRepository->find($default->id)->update(['default_address' => 0]);
|
||||
}
|
||||
|
||||
if ($address = $this->customerAddressRepository->find($id)) {
|
||||
$address->update(['default_address' => 1]);
|
||||
|
|
@ -208,8 +209,9 @@ class AddressController extends Controller
|
|||
'customer_id' => auth()->guard('customer')->user()->id,
|
||||
]);
|
||||
|
||||
if (! $address)
|
||||
if (! $address) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$this->customerAddressRepository->delete($id);
|
||||
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ class ResetPasswordController extends Controller
|
|||
{
|
||||
try {
|
||||
$this->validate(request(), [
|
||||
'token' => 'required',
|
||||
'email' => 'required|email',
|
||||
'token' => 'required',
|
||||
'email' => 'required|email',
|
||||
'password' => 'required|confirmed|min:6',
|
||||
]);
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class SessionController extends Controller
|
|||
public function create()
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'email' => 'required|email',
|
||||
'email' => 'required|email',
|
||||
'password' => 'required'
|
||||
]);
|
||||
|
||||
|
|
|
|||
|
|
@ -82,14 +82,14 @@ class WishlistController extends Controller
|
|||
return redirect()->back();
|
||||
|
||||
$data = [
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'product_id' => $itemId,
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'product_id' => $itemId,
|
||||
'customer_id' => auth()->guard('customer')->user()->id
|
||||
];
|
||||
|
||||
$checked = $this->wishlistRepository->findWhere([
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'product_id' => $itemId,
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'product_id' => $itemId,
|
||||
'customer_id' => auth()->guard('customer')->user()->id
|
||||
]);
|
||||
|
||||
|
|
@ -152,12 +152,13 @@ class WishlistController extends Controller
|
|||
public function move($itemId)
|
||||
{
|
||||
$wishlistItem = $this->wishlistRepository->findOneWhere([
|
||||
'id' => $itemId,
|
||||
'id' => $itemId,
|
||||
'customer_id' => auth()->guard('customer')->user()->id
|
||||
]);
|
||||
|
||||
if (! $wishlistItem)
|
||||
if (! $wishlistItem) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
try {
|
||||
$result = Cart::moveToCart($wishlistItem);
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ class CustomerAddress extends Model implements CustomerAddressContract
|
|||
'city',
|
||||
'postcode',
|
||||
'phone',
|
||||
'default_address',
|
||||
'first_name',
|
||||
'last_name',
|
||||
'default_address',
|
||||
'first_name',
|
||||
'last_name',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class CustomerResetPassword extends ResetPassword
|
|||
->subject(__('shop::app.mail.forget-password.subject') )
|
||||
->view('shop::emails.customer.forget-password', [
|
||||
'user_name' => $notifiable->name,
|
||||
'token' => $this->token
|
||||
'token' => $this->token
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ class CustomerAddressRepository extends Repository
|
|||
if ($default_address->id != $address->id) {
|
||||
$default_address->update(['default_address' => 0]);
|
||||
}
|
||||
|
||||
$address->update($data);
|
||||
} else {
|
||||
$address->update($data);
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class WishlistRepository extends Repository
|
|||
*/
|
||||
public function getCustomerWhishlist() {
|
||||
return $this->model->where([
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'customer_id' => auth()->guard('customer')->user()->id
|
||||
])->paginate(5);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ class VatValidator
|
|||
public function validate(string $vatNumber): bool
|
||||
{
|
||||
$vatNumber = $this->vatCleaner($vatNumber);
|
||||
|
||||
list($country, $number) = $this->splitVat($vatNumber);
|
||||
|
||||
if (! isset(self::$pattern_expression[$country])) {
|
||||
|
|
@ -81,6 +82,7 @@ class VatValidator
|
|||
private function vatCleaner(string $vatNumber): string
|
||||
{
|
||||
$vatNumber_no_spaces = trim($vatNumber);
|
||||
|
||||
return strtoupper($vatNumber_no_spaces);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue