Improved code style
This commit is contained in:
parent
0e990164e5
commit
4a6ac73bb6
|
|
@ -129,7 +129,10 @@ class CheckoutController extends Controller
|
|||
{
|
||||
$shippingMethod = request()->get('shipping_method');
|
||||
|
||||
if (Cart::hasError() || !$shippingMethod || ! Cart::saveShippingMethod($shippingMethod)) {
|
||||
if (Cart::hasError()
|
||||
|| !$shippingMethod
|
||||
|| ! Cart::saveShippingMethod($shippingMethod)
|
||||
) {
|
||||
abort(400);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ class Handler extends ExceptionHandler
|
|||
if (request()->expectsJson()) {
|
||||
return response()->json([
|
||||
'error' => isset($this->jsonErrorMessages[$statusCode])
|
||||
? $this->jsonErrorMessages[$statusCode]
|
||||
: 'Something went wrong, please try again later.'
|
||||
? $this->jsonErrorMessages[$statusCode]
|
||||
: 'Something went wrong, please try again later.'
|
||||
], $statusCode);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,9 @@ class ConfigurationForm extends FormRequest
|
|||
{
|
||||
$this->rules = [];
|
||||
|
||||
if (request()->has('general.design.admin_logo.logo_image') && ! request()->input('general.design.admin_logo.logo_image.delete')) {
|
||||
if (request()->has('general.design.admin_logo.logo_image')
|
||||
&& ! request()->input('general.design.admin_logo.logo_image.delete')
|
||||
) {
|
||||
$this->rules = [
|
||||
'general.design.admin_logo.logo_image' => 'required|mimes:jpeg,bmp,png,jpg'
|
||||
];
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ class AttributeRepository extends Repository
|
|||
$attribute->type == 'select'
|
||||
|| $attribute->type == 'multiselect'
|
||||
|| $attribute->code == 'sku'
|
||||
)) {
|
||||
)) {
|
||||
if ($attribute->options()->exists()) {
|
||||
array_push($trimmed, [
|
||||
'id' => $attribute->id,
|
||||
|
|
|
|||
|
|
@ -148,8 +148,8 @@ class Booking
|
|||
}
|
||||
|
||||
return count($slots)
|
||||
? implode(' | ', $slots)
|
||||
: '<span class="text-danger">' . trans('bookingproduct::app.shop.products.closed') . '</span>';
|
||||
? implode(' | ', $slots)
|
||||
: '<span class="text-danger">' . trans('bookingproduct::app.shop.products.closed') . '</span>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -182,12 +182,12 @@ class Booking
|
|||
$currentTime = Carbon::now();
|
||||
|
||||
$availableFrom = ! $bookingProduct->available_from && $bookingProduct->available_from
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from)
|
||||
: clone $currentTime;
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from)
|
||||
: clone $currentTime;
|
||||
|
||||
$availableTo = ! $bookingProduct->available_from && $bookingProduct->available_to
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to)
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to)
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
|
||||
for ($i = 0; $i < 7; $i++) {
|
||||
$date = clone $currentTime;
|
||||
|
|
@ -264,16 +264,16 @@ class Booking
|
|||
$currentTime = Carbon::now();
|
||||
|
||||
$availableFrom = ! $bookingProduct->available_every_week && $bookingProduct->available_from
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from)
|
||||
: Carbon::createFromTimeString($currentTime);
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from)
|
||||
: Carbon::createFromTimeString($currentTime);
|
||||
|
||||
$availableTo = ! $bookingProduct->available_every_week && $bookingProduct->available_from
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to)
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to)
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
|
||||
$timeDurations = $bookingProductSlot->same_slot_all_days
|
||||
? $bookingProductSlot->slots
|
||||
: ($bookingProductSlot->slots[$requestedDate->format('w')] ?? []);
|
||||
? $bookingProductSlot->slots
|
||||
: ($bookingProductSlot->slots[$requestedDate->format('w')] ?? []);
|
||||
|
||||
$slots = [];
|
||||
|
||||
|
|
@ -306,8 +306,8 @@ class Booking
|
|||
if (($startDayTime <= $from && $from <= $availableTo)
|
||||
&& ($availableTo >= $to && $to >= $startDayTime)
|
||||
&& ($startDayTime <= $from && $from <= $endDayTime)
|
||||
&& ($endDayTime >= $to && $to >= $startDayTime)) {
|
||||
|
||||
&& ($endDayTime >= $to && $to >= $startDayTime)
|
||||
) {
|
||||
// Get already ordered qty for this slot
|
||||
$orderedQty = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ class DefaultSlot extends Booking
|
|||
|
||||
if ($requestedDate < $currentTime
|
||||
|| $requestedDate < $availableFrom
|
||||
|| $requestedDate > $availableTo) {
|
||||
|| $requestedDate > $availableTo
|
||||
) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
|
@ -144,8 +145,8 @@ class DefaultSlot extends Booking
|
|||
if (($startDayTime <= $from && $from <= $availableTo)
|
||||
&& ($availableTo >= $to && $to >= $startDayTime)
|
||||
&& ($startDayTime <= $from && $from <= $endDayTime)
|
||||
&& ($endDayTime >= $to && $to >= $startDayTime)) {
|
||||
|
||||
&& ($endDayTime >= $to && $to >= $startDayTime)
|
||||
) {
|
||||
// Get already ordered qty for this slot
|
||||
$orderedQty = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -66,8 +66,8 @@ class RentalSlot extends Booking
|
|||
if (($startDayTime <= $from && $from <= $availableTo)
|
||||
&& ($availableTo >= $to && $to >= $startDayTime)
|
||||
&& ($startDayTime <= $from && $from <= $endDayTime)
|
||||
&& ($endDayTime >= $to && $to >= $startDayTime)) {
|
||||
|
||||
&& ($endDayTime >= $to && $to >= $startDayTime)
|
||||
) {
|
||||
// Get already ordered qty for this slot
|
||||
$orderedQty = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,9 @@ class BookingProductRepository extends Repository
|
|||
$bookingProductTypeSlot = $this->typeRepositories[$data['type']]->findOneByField('booking_product_id', $id);
|
||||
|
||||
if (isset($data['slots'])) {
|
||||
$data['slots'] = $this->formatSlots($data);
|
||||
$data['slots'] = $this->validateSlots(
|
||||
$this->formatSlots($data)
|
||||
);
|
||||
}
|
||||
|
||||
if (! $bookingProductTypeSlot) {
|
||||
|
|
@ -142,4 +144,17 @@ class BookingProductRepository extends Repository
|
|||
|
||||
return $data['slots'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
public function validateSlots($data)
|
||||
{
|
||||
foreach ($data['slots'] as $key => $timeInterval) {
|
||||
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
|
@ -142,7 +142,8 @@ class CatalogRuleProduct
|
|||
|| ! isset($condition['value'])
|
||||
|| is_null($condition['value'])
|
||||
|| $condition['value'] == ''
|
||||
|| in_array($condition['attribute'], $appliedAttributes)) {
|
||||
|| in_array($condition['attribute'], $appliedAttributes)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -385,9 +385,9 @@ class Core
|
|||
if (($targetCurrencyCode != $this->lastOrderCode)
|
||||
&& ($targetCurrencyCode != $orderCurrencyCode)
|
||||
&& ($orderCurrencyCode != $this->getBaseCurrencyCode())
|
||||
&& ($orderCurrencyCode != $this->lastCurrencyCode)) {
|
||||
|
||||
$amount = $this->convertToBasePrice($amount, $orderCurrencyCode);
|
||||
&& ($orderCurrencyCode != $this->lastCurrencyCode)
|
||||
) {
|
||||
$amount = $this->convertToBasePrice($amount, $orderCurrencyCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,13 +70,13 @@ class PriceUpdate extends Command
|
|||
$product->parent->save();
|
||||
} else {
|
||||
$bundleProducts = $this->productFlatRepository->getModel()
|
||||
->addSelect('product_flat.*')
|
||||
->distinct()
|
||||
->leftJoin('products', 'product_flat.product_id', 'products.id')
|
||||
->leftJoin('product_bundle_options', 'products.id', 'product_bundle_options.product_id')
|
||||
->leftJoin('product_bundle_option_products', 'product_bundle_options.id', 'product_bundle_option_productsproduct_bundle_option_id')
|
||||
->where('product_bundle_option_products.product_id', $product->product_id)
|
||||
->get();
|
||||
->addSelect('product_flat.*')
|
||||
->distinct()
|
||||
->leftJoin('products', 'product_flat.product_id', 'products.id')
|
||||
->leftJoin('product_bundle_options', 'products.id', 'product_bundle_options.product_id')
|
||||
->leftJoin('product_bundle_option_products', 'product_bundle_options.id', 'product_bundle_option_productsproduct_bundle_option_id')
|
||||
->where('product_bundle_option_products.product_id', $product->product_id)
|
||||
->get();
|
||||
|
||||
foreach ($bundleProducts as $bundleProduct) {
|
||||
$bundleProduct->min_price = $bundleProduct->getTypeInstance()->getMinimalPrice();
|
||||
|
|
|
|||
|
|
@ -142,15 +142,15 @@ class ProductController extends Controller
|
|||
{
|
||||
if (! request()->get('family')
|
||||
&& ProductType::hasVariants(request()->input('type'))
|
||||
&& request()->input('sku') != '') {
|
||||
|
||||
&& request()->input('sku') != ''
|
||||
) {
|
||||
return redirect(url()->current() . '?type=' . request()->input('type') . '&family=' . request()->input('attribute_family_id') . '&sku=' . request()->input('sku'));
|
||||
}
|
||||
|
||||
if (ProductType::hasVariants(request()->input('type'))
|
||||
&& (! request()->has('super_attributes')
|
||||
|| ! count(request()->get('super_attributes')))) {
|
||||
|
||||
|| ! count(request()->get('super_attributes')))
|
||||
) {
|
||||
session()->flash('error', trans('admin::app.catalog.products.configurable-error'));
|
||||
|
||||
return back();
|
||||
|
|
|
|||
|
|
@ -259,7 +259,10 @@ class Product extends Model implements ProductContract
|
|||
*/
|
||||
public function getAttribute($key)
|
||||
{
|
||||
if (! method_exists(static::class, $key) && ! in_array($key, ['parent_id', 'attribute_family_id']) && ! isset($this->attributes[$key])) {
|
||||
if (! method_exists(static::class, $key)
|
||||
&& ! in_array($key, ['parent_id', 'attribute_family_id'])
|
||||
&& ! isset($this->attributes[$key])
|
||||
) {
|
||||
if (isset($this->id)) {
|
||||
$this->attributes[$key] = '';
|
||||
|
||||
|
|
|
|||
|
|
@ -388,8 +388,8 @@ class Bundle extends AbstractType
|
|||
|
||||
|
||||
if ($prices['from']['regular_price']['price'] != $prices['to']['regular_price']['price']
|
||||
|| $prices['from']['final_price']['price'] != $prices['to']['final_price']['price']) {
|
||||
|
||||
|| $prices['from']['final_price']['price'] != $prices['to']['final_price']['price']
|
||||
) {
|
||||
$priceHtml .= '<span style="font-weight: 500;margin-top: 1px;margin-bottom: 1px;display: block;">To</span>';
|
||||
|
||||
if ($prices['to']['regular_price']['price'] != $prices['to']['final_price']['price']) {
|
||||
|
|
|
|||
|
|
@ -168,8 +168,8 @@ class InvoiceRepository extends Repository
|
|||
|
||||
if ($childOrderItem->product
|
||||
&& ! $childOrderItem->getTypeInstance()->isStockable()
|
||||
&& $childOrderItem->getTypeInstance()->showQuantityBox()) {
|
||||
|
||||
&& $childOrderItem->getTypeInstance()->showQuantityBox()
|
||||
) {
|
||||
$this->invoiceItemRepository->updateProductInventory([
|
||||
'invoice' => $invoice,
|
||||
'product' => $childOrderItem->product,
|
||||
|
|
@ -182,8 +182,8 @@ class InvoiceRepository extends Repository
|
|||
}
|
||||
} elseif ($orderItem->product
|
||||
&& ! $orderItem->getTypeInstance()->isStockable()
|
||||
&& $orderItem->getTypeInstance()->showQuantityBox()) {
|
||||
|
||||
&& $orderItem->getTypeInstance()->showQuantityBox()
|
||||
) {
|
||||
$this->invoiceItemRepository->updateProductInventory([
|
||||
'invoice' => $invoice,
|
||||
'product' => $orderItem->product,
|
||||
|
|
|
|||
|
|
@ -261,13 +261,14 @@ class TaxRateController extends Controller
|
|||
|
||||
foreach ($excelData as $data) {
|
||||
foreach ($data as $column => $uploadData) {
|
||||
if (!is_null($uploadData['zip_from']) && !is_null($uploadData['zip_to'])) {
|
||||
if (! is_null($uploadData['zip_from']) && ! is_null($uploadData['zip_to'])) {
|
||||
$uploadData['is_zip'] = 1;
|
||||
$uploadData['zip_code'] = NULL;
|
||||
}
|
||||
|
||||
if (isset($rateIdentifier)) {
|
||||
$id = array_search($uploadData['identifier'], $rateIdentifier);
|
||||
|
||||
if ($id) {
|
||||
$this->taxRateRepository->update($uploadData, $id);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ class ThemeViewFinder extends FileViewFinder
|
|||
$newPath = base_path() . '/' . $path;
|
||||
|
||||
$paths = Arr::prepend($paths, $newPath);
|
||||
|
||||
}
|
||||
|
||||
return $paths;
|
||||
|
|
|
|||
Loading…
Reference in New Issue