Coding standard updated

This commit is contained in:
jitendra 2019-01-15 17:24:41 +05:30
parent cedfeb034a
commit aae6593469
185 changed files with 862 additions and 856 deletions

View File

@ -28,7 +28,7 @@ class AddressController extends Controller
$this->customerAddress = $customerAddress;
if(auth()->guard('customer')->check()) {
if (auth()->guard('customer')->check()) {
$this->customer = auth()->guard('customer')->user();
} else {
$this->customer['message'] = 'unauthorized';
@ -46,7 +46,7 @@ class AddressController extends Controller
* @return response JSON
*/
public function get() {
if($this->customer == false) {
if ($this->customer == false) {
return response()->json($this->customer, 401);
} else {
$addresses = $this->customer->addresses;
@ -56,7 +56,7 @@ class AddressController extends Controller
}
public function getDefault() {
if($this->customer == false) {
if ($this->customer == false) {
return response()->json($this->customer, 401);
} else {
$defaultAddress = $this->customer->default_address;
@ -89,13 +89,13 @@ class AddressController extends Controller
$cust_id['customer_id'] = $this->customer->id;
$data = array_merge($cust_id, $data);
if($this->customer->addresses->count() == 0) {
if ($this->customer->addresses->count() == 0) {
$data['default_address'] = 1;
}
$result = $this->customerAddress->create($data);
if($result) {
if ($result) {
return response()->json(true, 200);
} else {
return response()->json(false, 200);
@ -111,11 +111,11 @@ class AddressController extends Controller
public function makeDefault($id) {
$defaultAddress = $this->customer->default_address;
if($defaultAddress != null && $defaultAddress->count() > 0) {
if ($defaultAddress != null && $defaultAddress->count() > 0) {
$defaultAddress->update(['default_address' => 0]);
}
if($this->customerAddress->find($id)->default_address == 1) {
if ($this->customerAddress->find($id)->default_address == 1) {
return response()->json(false, 200);
}

View File

@ -26,8 +26,8 @@ class AuthController extends Controller
public function create() {
$data = request()->except('_token');
if(!auth()->guard('customer')->check()) {
if(!auth()->guard('customer')->attempt($data)) {
if (! auth()->guard('customer')->check()) {
if (! auth()->guard('customer')->attempt($data)) {
return response()->json(['message' => 'unauthenticated', 'details' => 'invalid creds'], 401);
} else {
return response()->json(['message' => 'authenticated', 'user' => auth()->guard('customer')->user()], 200);

View File

@ -23,7 +23,7 @@ class CustomerController extends Controller
public function __construct()
{
if(auth()->guard('customer')->check()) {
if (auth()->guard('customer')->check()) {
$this->customer = auth()->guard('customer')->user();
} else {
$this->customer['message'] = 'unauthorized';
@ -63,10 +63,10 @@ class CustomerController extends Controller
$data = collect(request()->all())->toArray();
if($data['oldpassword'] == null) {
if ($data['oldpassword'] == null) {
$data = collect(request()->input())->except([ 'oldpassword', 'password', 'password_confirmation'])->toArray();
} else {
if(Hash::check($data['oldpassword'], auth()->guard('customer')->user()->password)) {
if (Hash::check($data['oldpassword'], auth()->guard('customer')->user()->password)) {
$data = collect(request()->input())->toArray();
$data['password'] = bcrypt($data['password']);
@ -77,7 +77,7 @@ class CustomerController extends Controller
$result = $this->customer->update($data);
if($result) {
if ($result) {
return response()->json(true, 200);
} else {
return response()->json(false, 200);
@ -92,7 +92,7 @@ class CustomerController extends Controller
public function getAllCart() {
$carts = $this->customer->carts;
if($cart->count() > 0) {
if ($cart->count() > 0) {
return response()->json(['message' => 'successful','items' => $cart], 200);
} else {
return response()->json(['message' => 'empty', 'items' => null], 200);
@ -102,11 +102,11 @@ class CustomerController extends Controller
public function getActiveCart() {
$cart = Cart::getCart();
if($cart == null) {
if ($cart == null) {
return response()->json(['message' => 'empty', 'items' => 'null']);
}
if($cart->count() > 0 ) {
if ($cart->count() > 0 ) {
return response()->json(['message' => 'success', 'items' => $cart]);
} else {
return response()->json(['message' => 'empty', 'items' => 'null']);

View File

@ -24,7 +24,7 @@ class WishlistController extends Controller
public function __construct(Product $product, Wishlist $wishlist)
{
if(auth()->guard('customer')->check()) {
if (auth()->guard('customer')->check()) {
$this->product = $product;
$this->wishlist = $wishlist;
$this->customer = auth()->guard('customer')->user();
@ -43,7 +43,7 @@ class WishlistController extends Controller
{
$wishlist = $this->customer->wishlist_items;
if($wishlist->count() > 0) {
if ($wishlist->count() > 0) {
return response()->json($wishlist, 200);
} else {
return response()->json(['message' => 'Wishlist Empty', 'Items' => null], 200);
@ -67,14 +67,14 @@ class WishlistController extends Controller
];
//accidental case if some one adds id of the product in the anchor tag amd gives id of a variant.
if($product->parent_id != null) {
if ($product->parent_id != null) {
$data['product_id'] = $productId = $product->parent_id;
}
$checked = $this->wishlist->findWhere(['channel_id' => core()->getCurrentChannel()->id, 'product_id' => $productId, 'customer_id' => auth()->guard('customer')->user()->id]);
if($checked->isEmpty()) {
if($wishlistItem = $this->wishlist->create($data)) {
if ($checked->isEmpty()) {
if ($wishlistItem = $this->wishlist->create($data)) {
return response()->json(['message' => 'Successfully Added Item To Wishlist', 'items' => $wishlistItem], 200);
} else {
return response()->json(['message' => 'Error! Cannot Add Item To Wishlist', 'items' => null], 401);
@ -93,7 +93,7 @@ class WishlistController extends Controller
{
$result = $this->wishlist->deleteWhere(['customer_id' => auth()->guard('customer')->user()->id, 'channel_id' => core()->getCurrentChannel()->id, 'id' => $itemId]);
if($result) {
if ($result) {
return response()->json(['message' => 'Item Successfully Removed From Wishlist', 'status' => $result]);
} else {
return response()->json(['message' => 'Error! While Removing Item From Wishlist', 'status' => $result]);

View File

@ -89,7 +89,7 @@ class ReviewController extends Controller
$result = $this->productReview->create($data);
if($result) {
if ($result) {
return response()->json(['message' => 'success', 'status' => $result]);
} else {
return response()->json(['message' => 'failed', 'status' => $result]);

View File

@ -39,7 +39,7 @@ class CartController extends Controller
public function get() {
$cart = Cart::getCart();
if($cart == null || $cart == 'null') {
if ($cart == null || $cart == 'null') {
return response()->json(['message' => 'empty', 'items' => null]);
}
@ -54,7 +54,7 @@ class CartController extends Controller
public function add($id) {
$result = Cart::add($id, request()->all());
if($result) {
if ($result) {
Cart::collectTotals();
return response()->json(['message' => 'successful', 'items' => Cart::getCart()->items]);
@ -84,7 +84,7 @@ class CartController extends Controller
public function onePage() {
$cart = Cart::getCart();
if($cart == null || $cart == 'null') {
if ($cart == null || $cart == 'null') {
return response()->json(['message' => 'empty', 'items' => null]);
}
@ -102,13 +102,13 @@ class CartController extends Controller
public function updateOnePage() {
$request = request()->except('_token');
foreach($request['qty'] as $id => $quantity) {
if($quantity <= 0) {
foreach ($request['qty'] as $id => $quantity) {
if ($quantity <= 0) {
return response()->json(['message' => 'Illegal Quantity', 'status' => 'error']);
}
}
foreach($request['qty'] as $key => $value) {
foreach ($request['qty'] as $key => $value) {
$item = $this->cartItem->findOneByField('id', $key);
$data['quantity'] = $value;

View File

@ -71,7 +71,7 @@ class AttributeDataGrid extends DataGrid
'searchable' => false,
'width' => '100px',
'wrapper' => function($value) {
if($value == 1)
if ($value == 1)
return 'True';
else
return 'False';
@ -86,7 +86,7 @@ class AttributeDataGrid extends DataGrid
'searchable' => false,
'width' => '100px',
'wrapper' => function($value) {
if($value == 1)
if ($value == 1)
return 'True';
else
return 'False';
@ -101,7 +101,7 @@ class AttributeDataGrid extends DataGrid
'searchable' => false,
'width' => '100px',
'wrapper' => function($value) {
if($value == 1)
if ($value == 1)
return 'True';
else
return 'False';
@ -116,7 +116,7 @@ class AttributeDataGrid extends DataGrid
'searchable' => false,
'width' => '100px',
'wrapper' => function($value) {
if($value == 1)
if ($value == 1)
return 'True';
else
return 'False';

View File

@ -59,7 +59,7 @@ class CategoryDataGrid extends DataGrid
'searchable' => true,
'width' => '100px',
'wrapper' => function($value){
if($value == 1)
if ($value == 1)
return 'Active';
else
return 'Inactive';

View File

@ -69,9 +69,9 @@ class CustomerReviewDataGrid extends DataGrid
'width' => '100px',
'closure' => true,
'wrapper' => function ($value) {
if($value == 'approved')
if ($value == 'approved')
return '<span class="badge badge-md badge-success">Approved</span>';
else if($value == "pending")
else if ($value == "pending")
return '<span class="badge badge-md badge-warning">Pending</span>';
},
]);

View File

@ -68,7 +68,7 @@ class InventorySourcesDataGrid extends DataGrid
'sortable' => true,
'width' => '100px',
'wrapper' => function($value){
if($value == 1)
if ($value == 1)
return 'Active';
else
return 'Inactive';

View File

@ -41,7 +41,7 @@ class NewsLetterDataGrid extends DataGrid
'sortable' => true,
'width' => '100px',
'wrapper' => function($value){
if($value == 1)
if ($value == 1)
return 'True';
else
return 'False';

View File

@ -84,19 +84,19 @@ class OrderDataGrid extends DataGrid
'width' => '100px',
'closure' => true,
'wrapper' => function ($value) {
if($value == 'processing')
if ($value == 'processing')
return '<span class="badge badge-md badge-success">Processing</span>';
else if($value == 'completed')
else if ($value == 'completed')
return '<span class="badge badge-md badge-success">Completed</span>';
else if($value == "canceled")
else if ($value == "canceled")
return '<span class="badge badge-md badge-danger">Canceled</span>';
else if($value == "closed")
else if ($value == "closed")
return '<span class="badge badge-md badge-info">Closed</span>';
else if($value == "pending")
else if ($value == "pending")
return '<span class="badge badge-md badge-warning">Pending</span>';
else if($value == "pending_payment")
else if ($value == "pending_payment")
return '<span class="badge badge-md badge-warning">Pending Payment</span>';
else if($value == "fraud")
else if ($value == "fraud")
return '<span class="badge badge-md badge-danger">Fraud</span>';
}
]);

View File

@ -68,7 +68,7 @@ class ProductDataGrid extends DataGrid
'searchable' => false,
'width' => '100px',
'wrapper' => function($value) {
if($value == 1)
if ($value == 1)
return 'Active';
else
return 'Inactive';

View File

@ -50,7 +50,7 @@ class UserDataGrid extends DataGrid
'sortable' => true,
'width' => '100px',
'wrapper' => function($value) {
if($value == 1) {
if ($value == 1) {
return 'Active';
} else {
return 'Inactive';

View File

@ -35,7 +35,7 @@ class Handler extends ExceptionHandler
}
// else if ($exception instanceof ErrorException) {
// if(strpos($_SERVER['REQUEST_URI'], 'admin') !== false){
// if (strpos($_SERVER['REQUEST_URI'], 'admin') !== false){
// return response()->view('admin::errors.500', [], 500);
// }else {
// return response()->view('shop::errors.500', [], 500);

View File

@ -65,7 +65,7 @@ class ConfigurationController extends Controller
{
$tree = Tree::create();
foreach(config('core') as $item) {
foreach (config('core') as $item) {
$tree->add($item);
}
@ -83,7 +83,7 @@ class ConfigurationController extends Controller
{
$slugs = $this->getDefaultConfigSlugs();
if(count($slugs)) {
if (count($slugs)) {
return redirect()->route('admin.configuration.index', $slugs);
}
@ -99,7 +99,7 @@ class ConfigurationController extends Controller
{
$slugs = [];
if(!request()->route('slug')) {
if (! request()->route('slug')) {
$firstItem = current($this->configTree->items);
$secondItem = current($firstItem['children']);
@ -110,7 +110,7 @@ class ConfigurationController extends Controller
'slug2' => end($temp)
];
} else {
if(!request()->route('slug2')) {
if (! request()->route('slug2')) {
$secondItem = current($this->configTree->items[request()->route('slug')]['children']);
$temp = explode('.', $secondItem['key']);

View File

@ -129,7 +129,7 @@ class CustomerGroupController extends Controller
{
$group = $this->customerGroup->findOneByField('id', $id);
if($group->is_user_defined == 0) {
if ($group->is_user_defined == 0) {
session()->flash('warning', trans('admin::app.customers.customers.group-default'));
} else {
session()->flash('success', trans('admin::app.customers.customers.group-deleted'));

View File

@ -114,7 +114,7 @@ class DashboardController extends Controller
public function getPercentageChange($previous, $current)
{
if(!$previous)
if (! $previous)
return $current ? 100 : 0;
return ($current - $previous) / $previous * 100;
@ -291,7 +291,7 @@ class DashboardController extends Controller
? Carbon::createFromTimeString(request()->get('end') . " 23:59:59")
: Carbon::now();
if($this->endDate > Carbon::now())
if ($this->endDate > Carbon::now())
$this->endDate = Carbon::now();
$this->lastStartDate = clone $this->startDate;

View File

@ -91,7 +91,7 @@ class InvoiceController extends Controller
{
$order = $this->order->find($orderId);
if(!$order->canInvoice()) {
if (! $order->canInvoice()) {
session()->flash('error', 'Order invoice creation is not allowed.');
return redirect()->back();
@ -105,13 +105,13 @@ class InvoiceController extends Controller
$haveProductToInvoice = false;
foreach ($data['invoice']['items'] as $itemId => $qty) {
if($qty) {
if ($qty) {
$haveProductToInvoice = true;
break;
}
}
if(!$haveProductToInvoice) {
if (! $haveProductToInvoice) {
session()->flash('error', 'Invoice can not be created without products.');
return redirect()->back();

View File

@ -78,7 +78,7 @@ class OrderController extends Controller
{
$result = $this->order->cancel($id);
if($result) {
if ($result) {
session()->flash('success', trans('Order canceled successfully.'));
} else {
session()->flash('error', trans('Order can not be canceled.'));

View File

@ -91,7 +91,7 @@ class ShipmentController extends Controller
{
$order = $this->order->find($orderId);
if(!$order->channel || !$order->canShip()) {
if (! $order->channel || !$order->canShip()) {
session()->flash('error', 'Shipment can not be created for this order.');
return redirect()->back();
@ -111,7 +111,7 @@ class ShipmentController extends Controller
{
$order = $this->order->find($orderId);
if(!$order->canShip()) {
if (! $order->canShip()) {
session()->flash('error', 'Order shipment creation is not allowed.');
return redirect()->back();
@ -126,7 +126,7 @@ class ShipmentController extends Controller
$data = request()->all();
if(!$this->isInventoryValidate($data)) {
if (! $this->isInventoryValidate($data)) {
session()->flash('error', 'Requested quantity is invalid or not available.');
return redirect()->back();

View File

@ -47,7 +47,7 @@ class Product {
public function afterProductCreated($product) {
$result = $this->productCreated($product);
if($result) {
if ($result) {
return true;
} else {
return false;
@ -76,13 +76,13 @@ class Product {
$found = $this->productGrid->findOneByField('product_id', $product->id);
//extra measure to stop duplicate entries
if($found == null) {
if ($found == null) {
$this->productGrid->create($gridObject);
if($product->type == 'configurable') {
if ($product->type == 'configurable') {
$variants = $product->variants()->get();
foreach($variants as $variant) {
foreach ($variants as $variant) {
$variantObj = [
'product_id' => $variant->id,
'sku' => $variant->sku,
@ -130,7 +130,7 @@ class Product {
public function productUpdated($product) {
$productGridObject = $this->productGrid->findOneByField('product_id', $product->id);
if(!$productGridObject) {
if (! $productGridObject) {
return false;
}
@ -143,13 +143,13 @@ class Product {
'status' => $product->status,
];
if($product->type == 'configurable') {
if ($product->type == 'configurable') {
$gridObject['quantity'] = 0;
$gridObject['price'] = 0;
} else {
$qty = 0;
//inventories and inventory sources relation for the variants return empty or null collection objects only
foreach($product->inventories()->get() as $inventory_source) {
foreach ($product->inventories()->get() as $inventory_source) {
$qty = $qty + $inventory_source->qty;
}
@ -162,7 +162,7 @@ class Product {
if ($product->type == 'configurable') {
$variants = $product->variants()->get();
foreach($variants as $variant) {
foreach ($variants as $variant) {
$variantObj = [
'product_id' => $variant->id,
'sku' => $variant->sku,
@ -176,7 +176,7 @@ class Product {
$qty = 0;
//inventories and inventory sources relation for the variants return empty or null collection objects only
foreach($variant->inventories()->get() as $inventory_source) {
foreach ($variant->inventories()->get() as $inventory_source) {
$qty = $qty + $inventory_source->qty;
}
@ -186,7 +186,7 @@ class Product {
$productGridVariant = $this->productGrid->findOneByField('product_id', $variant->id);
if(isset($productGridVariant)) {
if (isset($productGridVariant)) {
$this->productGrid->update($variantObj, $productGridVariant->id);
} else {
$variantObj = [
@ -202,7 +202,7 @@ class Product {
$qty = 0;
//inventories and inventory sources relation for the variants return empty or null collection objects only
foreach($variant->inventories()->get() as $inventory_source) {
foreach ($variant->inventories()->get() as $inventory_source) {
$qty = $qty + $inventory_source->qty;
}
@ -224,7 +224,7 @@ class Product {
public function sync() {
$gridObject = [];
foreach($this->product->all() as $product) {
foreach ($this->product->all() as $product) {
$gridObject = [
'product_id' => $product->id,
'sku' => $product->sku,
@ -235,12 +235,12 @@ class Product {
'status' => $product->status
];
if($product->type == 'configurable') {
if ($product->type == 'configurable') {
$gridObject['quantity'] = 0;
} else {
$qty = 0;
foreach($product->toArray()['inventories'] as $inventorySource) {
foreach ($product->toArray()['inventories'] as $inventorySource) {
$qty = $qty + $inventorySource['qty'];
}
@ -251,7 +251,7 @@ class Product {
$oldGridObject = $this->productGrid->findOneByField('product_id', $product->id);
if($oldGridObject) {
if ($oldGridObject) {
$oldGridObject->update($gridObject);
} else {
$this->productGrid->create($gridObject);

View File

@ -65,7 +65,7 @@ class AdminServiceProvider extends ServiceProvider
view()->composer(['admin::catalog.products.create', 'admin::catalog.products.edit'], function ($view) {
$accordian = Tree::create();
foreach(config('product_form_accordians') as $item) {
foreach (config('product_form_accordians') as $item) {
$accordian->add($item);
}
@ -77,7 +77,7 @@ class AdminServiceProvider extends ServiceProvider
view()->composer(['admin::layouts.nav-left', 'admin::layouts.nav-aside', 'admin::layouts.tabs'], function ($view) {
$tree = Tree::create();
foreach(config('menu.admin') as $item) {
foreach (config('menu.admin') as $item) {
if (bouncer()->hasPermission($item['key'])) {
$tree->add($item, 'menu');
}
@ -114,12 +114,12 @@ class AdminServiceProvider extends ServiceProvider
{
static $tree;
if($tree)
if ($tree)
return $tree;
$tree = Tree::create();
foreach(config('acl') as $item) {
foreach (config('acl') as $item) {
$tree->add($item, 'acl');
}

View File

@ -57,7 +57,7 @@
<span class="control-error" v-if="errors.has('admin_name')">@{{ errors.first('admin_name') }}</span>
</div>
@foreach(Webkul\Core\Models\Locale::all() as $locale)
@foreach (Webkul\Core\Models\Locale::all() as $locale)
<div class="control-group">
<label for="locale-{{ $locale->code }}">{{ $locale->name . ' (' . $locale->code . ')' }}</label>
@ -173,7 +173,7 @@
<tr>
<th>{{ __('admin::app.catalog.attributes.admin_name') }}</th>
@foreach(Webkul\Core\Models\Locale::all() as $locale)
@foreach (Webkul\Core\Models\Locale::all() as $locale)
<th>{{ $locale->name . ' (' . $locale->code . ')' }}</th>
@ -194,7 +194,7 @@
</div>
</td>
@foreach(Webkul\Core\Models\Locale::all() as $locale)
@foreach (Webkul\Core\Models\Locale::all() as $locale)
<td>
<div class="control-group" :class="[errors.has(localeInputName(row, '{{ $locale->code }}')) ? 'has-error' : '']">
<input type="text" v-validate="'required'" v-model="row['{{ $locale->code }}']" :name="localeInputName(row, '{{ $locale->code }}')" class="control" data-vv-as="&quot;{{ $locale->name . ' (' . $locale->code . ')' }}&quot;"/>
@ -227,7 +227,7 @@
<script>
$(document).ready(function () {
$('#type').on('change', function (e) {
if(['select', 'multiselect', 'checkbox'].indexOf($(e.target).val()) === -1) {
if (['select', 'multiselect', 'checkbox'].indexOf($(e.target).val()) === -1) {
$('#options').parent().addClass('hide')
} else {
$('#options').parent().removeClass('hide')
@ -248,7 +248,7 @@
var rowCount = this.optionRowCount++;
var row = {'id': 'option_' + rowCount};
@foreach(Webkul\Core\Models\Locale::all() as $locale)
@foreach (Webkul\Core\Models\Locale::all() as $locale)
row['{{ $locale->code }}'] = '';
@endforeach

View File

@ -77,7 +77,7 @@
<span class="control-error" v-if="errors.has('admin_name')">@{{ errors.first('admin_name') }}</span>
</div>
@foreach(Webkul\Core\Models\Locale::all() as $locale)
@foreach (Webkul\Core\Models\Locale::all() as $locale)
<div class="control-group">
<label for="locale-{{ $locale->code }}">{{ $locale->name . ' (' . $locale->code . ')' }}</label>
@ -229,7 +229,7 @@
<tr>
<th>{{ __('admin::app.catalog.attributes.admin_name') }}</th>
@foreach(Webkul\Core\Models\Locale::all() as $locale)
@foreach (Webkul\Core\Models\Locale::all() as $locale)
<th>{{ $locale->name . ' (' . $locale->code . ')' }}</th>
@ -250,7 +250,7 @@
</div>
</td>
@foreach(Webkul\Core\Models\Locale::all() as $locale)
@foreach (Webkul\Core\Models\Locale::all() as $locale)
<td>
<div class="control-group" :class="[errors.has(localeInputName(row, '{{ $locale->code }}')) ? 'has-error' : '']">
<input type="text" v-validate="'required'" v-model="row['{{ $locale->code }}']" :name="localeInputName(row, '{{ $locale->code }}')" class="control" data-vv-as="&quot;{{ $locale->name . ' (' . $locale->code . ')' }}&quot;"/>
@ -283,7 +283,7 @@
<script>
$(document).ready(function () {
$('#type').on('change', function (e) {
if(['select', 'multiselect', 'checkbox'].indexOf($(e.target).val()) === -1) {
if (['select', 'multiselect', 'checkbox'].indexOf($(e.target).val()) === -1) {
$('#options').parent().addClass('hide')
} else {
$('#options').parent().removeClass('hide')
@ -295,11 +295,11 @@
template: '#options-template',
created () {
@foreach($attribute->options as $option)
@foreach ($attribute->options as $option)
this.optionRowCount++;
var row = {'id': '{{ $option->id }}', 'admin_name': '{{ $option->admin_name }}', 'sort_order': '{{ $option->sort_order }}'};
@foreach(Webkul\Core\Models\Locale::all() as $locale)
@foreach (Webkul\Core\Models\Locale::all() as $locale)
row['{{ $locale->code }}'] = "{{ $option->translate($locale->code)['label'] }}";
@endforeach
@ -317,7 +317,7 @@
var rowCount = this.optionRowCount++;
var row = {'id': 'option_' + rowCount};
@foreach(Webkul\Core\Models\Locale::all() as $locale)
@foreach (Webkul\Core\Models\Locale::all() as $locale)
row['{{ $locale->code }}'] = '';
@endforeach

View File

@ -75,7 +75,7 @@
</div>
</accordian>
@if($categories->count())
@if ($categories->count())
<accordian :title="'{{ __('admin::app.catalog.categories.parent-category') }}'" :active="true">
<div slot="body">

View File

@ -16,7 +16,7 @@
<div class="control-group">
<select class="control" id="locale-switcher" onChange="window.location.href = this.value">
@foreach(core()->getAllLocales() as $localeModel)
@foreach (core()->getAllLocales() as $localeModel)
<option value="{{ route('admin.catalog.categories.update', $category->id) . '?locale=' . $localeModel->code }}" {{ ($localeModel->code) == $locale ? 'selected' : '' }}>
{{ $localeModel->name }}
@ -89,7 +89,7 @@
</div>
</accordian>
@if($categories->count())
@if ($categories->count())
<accordian :title="'{{ __('admin::app.catalog.categories.parent-category') }}'" :active="true">
<div slot="body">

View File

@ -202,7 +202,7 @@
return this_this.group.groupName.trim() === (group.name ? group.name.trim() : group.groupName.trim())
})
if(filteredGroups.length) {
if (filteredGroups.length) {
const field = this.$validator.fields.find({ name: 'groupName', scope: 'add-group-form' });
if (field) {
@ -248,7 +248,7 @@
group.custom_attributes.forEach(function(attribute) {
var attribute = this.custom_attributes.filter(attributeTemp => attributeTemp.id == attribute.id)
if(attribute.length) {
if (attribute.length) {
let index = this.custom_attributes.indexOf(attribute[0])
this.custom_attributes.splice(index, 1)
@ -323,7 +323,7 @@
$(e.target).prev().find('li input').each(function() {
var attributeId = $(this).val();
if($(this).is(':checked')) {
if ($(this).is(':checked')) {
attributeIds.push(attributeId);
$(this).prop('checked', false);

View File

@ -200,7 +200,7 @@
return this_this.group.groupName.trim() === (group.name ? group.name.trim() : group.groupName.trim())
})
if(filteredGroups.length) {
if (filteredGroups.length) {
const field = this.$validator.fields.find({ name: 'groupName', scope: 'add-group-form' });
if (field) {
@ -246,7 +246,7 @@
group.custom_attributes.forEach(function(attribute) {
var attribute = this.custom_attributes.filter(attributeTemp => attributeTemp.id == attribute.id)
if(attribute.length) {
if (attribute.length) {
let index = this.custom_attributes.indexOf(attribute[0])
this.custom_attributes.splice(index, 1)
@ -306,7 +306,7 @@
computed: {
groupInputName () {
if(this.group.id)
if (this.group.id)
return "attribute_groups[" + this.group.id + "]";
return "attribute_groups[group_" + this.index + "]";
@ -324,7 +324,7 @@
$(e.target).prev().find('li input').each(function() {
var attributeId = $(this).val();
if($(this).is(':checked')) {
if ($(this).is(':checked')) {
attributeIds.push(attributeId);
$(this).prop('checked', false);

View File

@ -1,4 +1,4 @@
@if($categories->count())
@if ($categories->count())
<accordian :title="'{{ __($accordian['name']) }}'" :active="true">
<div slot="body">

View File

@ -7,7 +7,7 @@
$qty = 0;
foreach ($product->inventories as $inventory) {
if($inventory->inventory_source_id == $inventorySource->id && !$inventory->vendor_id) {
if ($inventory->inventory_source_id == $inventorySource->id && ! $inventory->vendor_id) {
$qty = $inventory->qty;
break;
}

View File

@ -205,7 +205,7 @@
var matchCount = 0;
for (var key in this_this.variant) {
if(variant[key] == this_this.variant[key]) {
if (variant[key] == this_this.variant[key]) {
matchCount++;
}
}
@ -213,7 +213,7 @@
return matchCount == this_this.super_attributes.length;
})
if(filteredVariants.length) {
if (filteredVariants.length) {
this.$parent.closeModal();
window.flashMessages = [{'type': 'alert-error', 'message': "{{ __('admin::app.catalog.products.variant-already-exist-message') }}" }];
@ -297,7 +297,7 @@
computed: {
variantInputName () {
if(this.variant.id)
if (this.variant.id)
return "variants[" + this.variant.id + "]";
return "variants[variant_" + this.index + "]";
@ -314,7 +314,7 @@
this.superAttributes.forEach(function(attribute) {
attribute.options.forEach(function(option) {
if(optionId == option.id) {
if (optionId == option.id) {
optionName = option.admin_name;
}
});
@ -328,7 +328,7 @@
return inventorySourceId === inventory.inventory_source_id && !inventory.vendor_id;
})
if(inventories.length)
if (inventories.length)
return inventories[0]['qty'];
return 0;

View File

@ -51,7 +51,7 @@
<option value="configurable" {{ $familyId ? 'selected' : '' }}>{{ __('admin::app.catalog.products.configurable') }}</option>
</select>
@if($familyId)
@if ($familyId)
<input type="hidden" name="type" value="configurable"/>
@endif
<span class="control-error" v-if="errors.has('type')">@{{ errors.first('type') }}</span>
@ -61,12 +61,12 @@
<label for="attribute_family_id" class="required">{{ __('admin::app.catalog.products.familiy') }}</label>
<select class="control" v-validate="'required'" id="attribute_family_id" name="attribute_family_id" {{ $familyId ? 'disabled' : '' }} data-vv-as="&quot;{{ __('admin::app.catalog.products.familiy') }}&quot;">
<option value=""></option>
@foreach($families as $family)
@foreach ($families as $family)
<option value="{{ $family->id }}" {{ ($familyId == $family->id || old('attribute_family_id') == $family->id) ? 'selected' : '' }}>{{ $family->name }}</option>
@endforeach
</select>
@if($familyId)
@if ($familyId)
<input type="hidden" name="attribute_family_id" value="{{ $familyId }}"/>
@endif
<span class="control-error" v-if="errors.has('attribute_family_id')">@{{ errors.first('attribute_family_id') }}</span>
@ -81,7 +81,7 @@
</div>
</accordian>
@if($familyId)
@if ($familyId)
<accordian :title="'{{ __('admin::app.catalog.products.configurable-attributes') }}'" :active="true">
<div slot="body">
@ -96,13 +96,13 @@
</thead>
<tbody>
@foreach($configurableFamily->configurable_attributes as $attribute)
@foreach ($configurableFamily->configurable_attributes as $attribute)
<tr>
<td>
{{ $attribute->admin_name }}
</td>
<td>
@foreach($attribute->options as $option)
@foreach ($attribute->options as $option)
<span class="label">
<input type="hidden" name="super_attributes[{{$attribute->code}}][]" value="{{ $option->id }}"/>
{{ $option->admin_name }}

View File

@ -18,7 +18,7 @@
<div class="control-group">
<select class="control" id="channel-switcher" name="channel">
@foreach(core()->getAllChannels() as $channelModel)
@foreach (core()->getAllChannels() as $channelModel)
<option value="{{ $channelModel->code }}" {{ ($channelModel->code) == $channel ? 'selected' : '' }}>
{{ $channelModel->name }}
@ -30,7 +30,7 @@
<div class="control-group">
<select class="control" id="locale-switcher" name="locale">
@foreach(core()->getAllLocales() as $localeModel)
@foreach (core()->getAllLocales() as $localeModel)
<option value="{{ $localeModel->code }}" {{ ($localeModel->code) == $locale ? 'selected' : '' }}>
{{ $localeModel->name }}
@ -54,19 +54,19 @@
<input name="_method" type="hidden" value="PUT">
@foreach ($product->attribute_family->attribute_groups as $attributeGroup)
@if(count($attributeGroup->custom_attributes))
@if (count($attributeGroup->custom_attributes))
<accordian :title="'{{ __($attributeGroup->name) }}'" :active="true">
<div slot="body">
@foreach($attributeGroup->custom_attributes as $attribute)
@foreach ($attributeGroup->custom_attributes as $attribute)
@if(!$product->super_attributes->contains($attribute))
@if (! $product->super_attributes->contains($attribute))
<?php
$validations = [];
$disabled = false;
if($product->type == 'configurable' && in_array($attribute->code, ['price', 'cost', 'special_price', 'special_price_from', 'special_price_to', 'width', 'height', 'depth', 'weight'])) {
if(!$attribute->is_required)
if ($product->type == 'configurable' && in_array($attribute->code, ['price', 'cost', 'special_price', 'special_price_from', 'special_price_to', 'width', 'height', 'depth', 'weight'])) {
if (! $attribute->is_required)
continue;
$disabled = true;
@ -85,7 +85,7 @@
$validations = implode('|', array_filter($validations));
?>
@if(view()->exists($typeView = 'admin::catalog.products.field-types.' . $attribute->type))
@if (view()->exists($typeView = 'admin::catalog.products.field-types.' . $attribute->type))
<div class="control-group {{ $attribute->type }}" :class="[errors.has('{{ $attribute->code }}') ? 'has-error' : '']">
<label for="{{ $attribute->code }}" {{ $attribute->is_required ? 'class=required' : '' }}>
@ -97,16 +97,16 @@
<?php
$channel_locale = [];
if($attribute->value_per_channel) {
if ($attribute->value_per_channel) {
array_push($channel_locale, $channel);
}
if($attribute->value_per_locale) {
if ($attribute->value_per_locale) {
array_push($channel_locale, $locale);
}
?>
@if(count($channel_locale))
@if (count($channel_locale))
<span class="locale">[{{ implode(' - ', $channel_locale) }}]</span>
@endif
</label>

View File

@ -1,6 +1,6 @@
<select v-validate="'{{$validations}}'" class="control" id="{{ $attribute->code }}" name="{{ $attribute->code }}" data-vv-as="&quot;{{ $attribute->admin_name }}&quot;" multiple {{ $disabled ? 'disabled' : '' }}>
@foreach($attribute->options as $option)
@foreach ($attribute->options as $option)
<option value="{{ $option->id }}" {{ in_array($option->id, explode(',', $attribute[$attribute->code])) ? 'selected' : ''}}>
{{ $option->admin_name }}
</option>

View File

@ -2,9 +2,9 @@
<?php $selectedOption = old($attribute->code) ?: $product[$attribute->code] ?>
@if($attribute->code != 'tax_category_id')
@if ($attribute->code != 'tax_category_id')
@foreach($attribute->options as $option)
@foreach ($attribute->options as $option)
<option value="{{ $option->id }}" {{ $option->id == $selectedOption ? 'selected' : ''}}>
{{ $option->admin_name }}
</option>
@ -14,7 +14,7 @@
<option value=""></option>
@foreach(app('Webkul\Tax\Repositories\TaxCategoryRepository')->all() as $taxCategory)
@foreach (app('Webkul\Tax\Repositories\TaxCategoryRepository')->all() as $taxCategory)
<option value="{{ $taxCategory->id }}" {{ $taxCategory->id == $selectedOption ? 'selected' : ''}}>
{{ $taxCategory->name }}
</option>

View File

@ -26,12 +26,12 @@
$channel_locale = [];
if(isset($field['channel_based']) && $field['channel_based'])
if (isset($field['channel_based']) && $field['channel_based'])
{
array_push($channel_locale, $channel);
}
if(isset($field['locale_based']) && $field['locale_based']) {
if (isset($field['locale_based']) && $field['locale_based']) {
array_push($channel_locale, $locale);
}
?>
@ -42,7 +42,7 @@
{{ $field['title'] }}
@if(count($channel_locale))
@if (count($channel_locale))
<span class="locale">[{{ implode(' - ', $channel_locale) }}]</span>
@endif
@ -61,15 +61,15 @@
<select v-validate="'{{ $validations }}'" class="control" id="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" data-vv-as="&quot;{{ $field['name'] }}&quot;" >
@if (isset($field['repository']))
@foreach($value as $option)
@foreach ($value as $option)
<option value="{{ $option['name'] }}" {{ $option['name'] == $selectedOption ? 'selected' : ''}}
{{ $option['name'] }}
</option>
@endforeach
@else
@foreach($field['options'] as $option)
@foreach ($field['options'] as $option)
<?php
if($option['value'] == false) {
if ($option['value'] == false) {
$value = 0;
} else {
$value = $option['value'];
@ -90,10 +90,10 @@
<select v-validate="'{{ $validations }}'" class="control" id="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}][]" data-vv-as="&quot;{{ $field['name'] }}&quot;" multiple>
@foreach($field['options'] as $option)
@foreach ($field['options'] as $option)
<?php
if($option['value'] == false) {
if ($option['value'] == false) {
$value = 0;
} else {
$value = $option['value'];
@ -224,7 +224,7 @@
this.country = country;
})
if(this.countryStates[this.country] && this.countryStates[this.country].length)
if (this.countryStates[this.country] && this.countryStates[this.country].length)
return true;
return false;

View File

@ -20,7 +20,7 @@
<div class="control-group">
<select class="control" id="channel-switcher" name="channel">
@foreach(core()->getAllChannels() as $channelModel)
@foreach (core()->getAllChannels() as $channelModel)
<option value="{{ $channelModel->code }}" {{ ($channelModel->code) == $channel ? 'selected' : '' }}>
{{ $channelModel->name }}
@ -32,7 +32,7 @@
<div class="control-group">
<select class="control" id="locale-switcher" name="locale">
@foreach(core()->getAllLocales() as $localeModel)
@foreach (core()->getAllLocales() as $localeModel)
<option value="{{ $localeModel->code }}" {{ ($localeModel->code) == $locale ? 'selected' : '' }}>
{{ $localeModel->name }}

View File

@ -65,7 +65,7 @@
methods: {
haveStates() {
if(this.countryStates[this.country] && this.countryStates[this.country].length)
if (this.countryStates[this.country] && this.countryStates[this.country].length)
return true;
return false;

View File

@ -75,14 +75,14 @@
<div class="control-group">
<label for="customerGroup" >{{ __('admin::app.customers.customers.customer_group') }}</label>
@if(!is_null($customer->customer_group_id))
@if (! is_null($customer->customer_group_id))
<?php $selectedCustomerOption = $customer->customerGroup->id ?>
@else
<?php $selectedCustomerOption = '' ?>
@endif
<select class="control" name="customer_group_id">
@foreach($customerGroup as $group)
@foreach ($customerGroup as $group)
<option value="{{ $group->id }}" {{ $selectedCustomerOption == $group->id ? 'selected' : '' }}>
{{ $group->name}}
</option>
@ -93,14 +93,14 @@
<div class="control-group" :class="[errors.has('channel_id') ? 'has-error' : '']">
<label for="channel" >{{ __('admin::app.customers.customers.channel_name') }}</label>
@if(!is_null($customer->channel_id))
@if (! is_null($customer->channel_id))
<?php $selectedChannelOption = $customer->channel_id ?>
@else
<?php $selectedChannelOption = $customer->channel_id ?>
@endif
<select class="control" name="channel_id" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customers.customers.channel_name') }}&quot;">
@foreach($channelName as $channel)
@foreach ($channelName as $channel)
<option value="{{ $channel->id }}" {{ $selectedChannelOption == $channel->id ? 'selected' : '' }}>
{{ $channel->name}}
</option>

View File

@ -32,8 +32,8 @@
<label for="title">{{ __('admin::app.customers.subscribers.is_subscribed') }}</label>
<select class="control" name="is_subscribed" v-validate="'required'" data-vv-as="&quot;{{ __('admin::app.customers.subscribers.is_subscribed') }}&quot;">
<option value="1" @if($subscriber->is_subscribed == 1) selected @endif>{{ __('admin::app.common.true') }}</option>
<option value="0" @if($subscriber->is_subscribed == 0) selected @endif>{{ __('admin::app.common.false') }}</option>
<option value="1" @if ($subscriber->is_subscribed == 1) selected @endif>{{ __('admin::app.common.true') }}</option>
<option value="0" @if ($subscriber->is_subscribed == 0) selected @endif>{{ __('admin::app.common.false') }}</option>
</select>
<span class="control-error" v-if="errors.has('is_subscribed')">@{{ errors.first('is_subscribed') }}</span>

View File

@ -176,7 +176,7 @@
</ul>
@if (!count($statistics['top_selling_categories']))
@if (! count($statistics['top_selling_categories']))
<div class="no-result-found">
@ -231,7 +231,7 @@
</ul>
@if (!count($statistics['top_selling_products']))
@if (! count($statistics['top_selling_products']))
<div class="no-result-found">
@ -289,7 +289,7 @@
</ul>
@if (!count($statistics['customer_with_most_sales']))
@if (! count($statistics['customer_with_most_sales']))
<div class="no-result-found">
@ -339,7 +339,7 @@
</ul>
@if (!count($statistics['stock_threshold']))
@if (! count($statistics['stock_threshold']))
<div class="no-result-found">

View File

@ -94,11 +94,11 @@
<script type="text/javascript">
window.flashMessages = [];
@if($success = session('success'))
@if ($success = session('success'))
window.flashMessages = [{'type': 'alert-success', 'message': "{{ $success }}" }];
@elseif($warning = session('warning'))
@elseif ($warning = session('warning'))
window.flashMessages = [{'type': 'alert-warning', 'message': "{{ $warning }}" }];
@elseif($error = session('error'))
@elseif ($error = session('error'))
window.flashMessages = [{'type': 'alert-error', 'message': "{{ $error }}" }];
@endif

View File

@ -54,18 +54,18 @@
<script type="text/javascript">
window.flashMessages = [];
@if($success = session('success'))
@if ($success = session('success'))
window.flashMessages = [{'type': 'alert-success', 'message': "{{ $success }}" }];
@elseif($warning = session('warning'))
@elseif ($warning = session('warning'))
window.flashMessages = [{'type': 'alert-warning', 'message': "{{ $warning }}" }];
@elseif($error = session('error'))
@elseif ($error = session('error'))
window.flashMessages = [{'type': 'alert-error', 'message': "{{ $error }}" }];
@elseif($info = session('info'))
@elseif ($info = session('info'))
window.flashMessages = [{'type': 'alert-error', 'message': "{{ $info }}" }];
@endif
window.serverErrors = [];
@if(isset($errors))
@if (isset($errors))
@if (count($errors))
window.serverErrors = @json($errors->getMessages());
@endif

View File

@ -3,7 +3,7 @@
@if (request()->route()->getName() != 'admin.configuration.index')
<?php $keys = explode('.', $menu->currentKey); ?>
@foreach(array_get($menu->items, current($keys) . '.children') as $item)
@foreach (array_get($menu->items, current($keys) . '.children') as $item)
<li class="{{ $menu->getActive($item) }}">
<a href="{{ $item['url'] }}">
{{ trans($item['name']) }}
@ -15,7 +15,7 @@
</li>
@endforeach
@else
@foreach($config->items as $key => $item)
@foreach ($config->items as $key => $item)
<li class="{{ $item['key'] == request()->route('slug') ? 'active' : '' }}">
<a href="{{ route('admin.configuration.index', $item['key']) }}">
{{ isset($item['name']) ? trans($item['name']) : '' }}

View File

@ -1,6 +1,6 @@
<div class="navbar-left">
<ul class="menubar">
@foreach($menu->items as $menuItem)
@foreach ($menu->items as $menuItem)
<li class="menu-item {{ $menu->getActive($menuItem) }}">
<a href="{{ count($menuItem['children']) ? current($menuItem['children'])['url'] : $menuItem['url'] }}">
<span class="icon {{ $menuItem['icon-class'] }}">

View File

@ -8,7 +8,7 @@
<ul>
@foreach(array_get($menu->items, implode('.children.', array_slice($keys, 0, 2)) . '.children') as $item)
@foreach (array_get($menu->items, implode('.children.', array_slice($keys, 0, 2)) . '.children') as $item)
<li class="{{ $menu->getActive($item) }}">
<a href="{{ $item['url'] }}">

View File

@ -121,7 +121,7 @@
</div>
</div>
@if($order->shipping_address)
@if ($order->shipping_address)
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.shipping-address') }}</span>

View File

@ -121,7 +121,7 @@
</div>
</div>
@if($order->shipping_address)
@if ($order->shipping_address)
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.shipping-address') }}</span>

View File

@ -15,19 +15,19 @@
</div>
<div class="page-action">
@if($order->canCancel())
@if ($order->canCancel())
<a href="{{ route('admin.sales.orders.cancel', $order->id) }}" class="btn btn-lg btn-primary" v-alert:message="'{{ __('admin::app.sales.orders.cancel-confirm-msg') }}'">
{{ __('admin::app.sales.orders.cancel-btn-title') }}
</a>
@endif
@if($order->canInvoice())
@if ($order->canInvoice())
<a href="{{ route('admin.sales.invoices.create', $order->id) }}" class="btn btn-lg btn-primary">
{{ __('admin::app.sales.orders.invoice-btn-title') }}
</a>
@endif
@if($order->canShip())
@if ($order->canShip())
<a href="{{ route('admin.sales.shipments.create', $order->id) }}" class="btn btn-lg btn-primary">
{{ __('admin::app.sales.orders.shipment-btn-title') }}
</a>
@ -108,7 +108,7 @@
</span>
</div>
@if(!is_null($order->customer))
@if (! is_null($order->customer))
<div class="row">
<span class="title">
{{ __('admin::app.customers.customers.customer_group') }}
@ -140,7 +140,7 @@
</div>
</div>
@if($order->shipping_address)
@if ($order->shipping_address)
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.shipping-address') }}</span>
@ -359,7 +359,7 @@
</tr>
@endforeach
@if (!$order->invoices->count())
@if (! $order->invoices->count())
<tr>
<td class="empty" colspan="7">{{ __('admin::app.common.no-result-found') }}</td>
<tr>
@ -403,7 +403,7 @@
</tr>
@endforeach
@if (!$order->shipments->count())
@if (! $order->shipments->count())
<tr>
<td class="empty" colspan="7">{{ __('admin::app.common.no-result-found') }}</td>
<tr>

View File

@ -121,7 +121,7 @@
</div>
</div>
@if($order->shipping_address)
@if ($order->shipping_address)
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.shipping-address') }}</span>
@ -299,7 +299,7 @@
<td>
<?php
if($item->type == 'configurable') {
if ($item->type == 'configurable') {
$sourceQty = $item->child->product->inventory_source_qty($inventorySource);
} else {
$sourceQty = $item->product->inventory_source_qty($inventorySource);
@ -312,7 +312,7 @@
$product = $item->type == 'configurable' ? $item->child->product : $item->product;
foreach ($product->inventories as $inventory) {
if($inventory->inventory_source_id == $inventorySource->id && !$inventory->vendor_id) {
if ($inventory->inventory_source_id == $inventorySource->id && !$inventory->vendor_id) {
$sourceQty = $inventory->qty;
break;
}

View File

@ -117,7 +117,7 @@
</div>
</div>
@if($order->shipping_address)
@if ($order->shipping_address)
<div class="sale-section">
<div class="secton-title">
<span>{{ __('admin::app.sales.orders.shipping-address') }}</span>

View File

@ -47,7 +47,7 @@
<div class="control-group" :class="[errors.has('inventory_sources[]') ? 'has-error' : '']">
<label for="inventory_sources" class="required">{{ __('admin::app.settings.channels.inventory_sources') }}</label>
<select v-validate="'required'" class="control" id="inventory_sources" name="inventory_sources[]" data-vv-as="&quot;{{ __('admin::app.settings.channels.inventory_sources') }}&quot;" multiple>
@foreach(app('Webkul\Inventory\Repositories\InventorySourceRepository')->all() as $inventorySource)
@foreach (app('Webkul\Inventory\Repositories\InventorySourceRepository')->all() as $inventorySource)
<option value="{{ $inventorySource->id }}" {{ old('inventory_sources') && in_array($inventorySource->id, old('inventory_sources')) ? 'selected' : '' }}>
{{ $inventorySource->name }}
</option>
@ -59,7 +59,7 @@
<div class="control-group" :class="[errors.has('root_category_id') ? 'has-error' : '']">
<label for="root_category_id" class="required">{{ __('admin::app.settings.channels.root-category') }}</label>
<select v-validate="'required'" class="control" id="root_category_id" name="root_category_id" data-vv-as="&quot;{{ __('admin::app.settings.channels.root-category') }}&quot;">
@foreach(app('Webkul\Category\Repositories\CategoryRepository')->getRootCategories() as $category)
@foreach (app('Webkul\Category\Repositories\CategoryRepository')->getRootCategories() as $category)
<option value="{{ $category->id }}" {{ old('root_category_id') == $category->id ? 'selected' : '' }}>
{{ $category->name }}
</option>
@ -82,7 +82,7 @@
<div class="control-group" :class="[errors.has('locales[]') ? 'has-error' : '']">
<label for="locales" class="required">{{ __('admin::app.settings.channels.locales') }}</label>
<select v-validate="'required'" class="control" id="locales" name="locales[]" data-vv-as="&quot;{{ __('admin::app.settings.channels.locales') }}&quot;" multiple>
@foreach(core()->getAllLocales() as $locale)
@foreach (core()->getAllLocales() as $locale)
<option value="{{ $locale->id }}" {{ old('locales') && in_array($locale->id, old('locales')) ? 'selected' : '' }}>
{{ $locale->name }}
</option>
@ -94,7 +94,7 @@
<div class="control-group" :class="[errors.has('default_locale_id') ? 'has-error' : '']">
<label for="default_locale_id" class="required">{{ __('admin::app.settings.channels.default-locale') }}</label>
<select v-validate="'required'" class="control" id="default_locale_id" name="default_locale_id" data-vv-as="&quot;{{ __('admin::app.settings.channels.default-locale') }}&quot;">
@foreach(core()->getAllLocales() as $locale)
@foreach (core()->getAllLocales() as $locale)
<option value="{{ $locale->id }}" {{ old('default_locale_id') == $locale->id ? 'selected' : '' }}>
{{ $locale->name }}
</option>
@ -106,7 +106,7 @@
<div class="control-group" :class="[errors.has('currencies[]') ? 'has-error' : '']">
<label for="currencies" class="required">{{ __('admin::app.settings.channels.currencies') }}</label>
<select v-validate="'required'" class="control" id="currencies" name="currencies[]" data-vv-as="&quot;{{ __('admin::app.settings.channels.currencies') }}&quot;" multiple>
@foreach(core()->getAllCurrencies() as $currency)
@foreach (core()->getAllCurrencies() as $currency)
<option value="{{ $currency->id }}" {{ old('currencies') && in_array($currency->id, old('currencies')) ? 'selected' : '' }}>
{{ $currency->name }}
</option>
@ -118,7 +118,7 @@
<div class="control-group" :class="[errors.has('base_currency_id') ? 'has-error' : '']">
<label for="base_currbase_currency_idency" class="required">{{ __('admin::app.settings.channels.base-currency') }}</label>
<select v-validate="'required'" class="control" id="base_currency_id" name="base_currency_id" data-vv-as="&quot;{{ __('admin::app.settings.channels.base-currency') }}&quot;">
@foreach(core()->getAllCurrencies() as $currency)
@foreach (core()->getAllCurrencies() as $currency)
<option value="{{ $currency->id }}" {{ old('base_currency_id') == $currency->id ? 'selected' : '' }}>
{{ $currency->name }}
</option>
@ -135,7 +135,7 @@
<div class="control-group">
<label for="theme">{{ __('admin::app.settings.channels.theme') }}</label>
<select class="control" id="theme" name="theme">
@foreach(themes()->all() as $theme)
@foreach (themes()->all() as $theme)
<option value="{{ $theme->code }}" {{ old('theme') == $theme->code ? 'selected' : '' }}>
{{ $theme->name }}
</option>

View File

@ -50,7 +50,7 @@
<label for="inventory_sources" class="required">{{ __('admin::app.settings.channels.inventory_sources') }}</label>
<?php $selectedOptionIds = old('inventory_sources') ?: $channel->inventory_sources->pluck('id')->toArray() ?>
<select v-validate="'required'" class="control" id="inventory_sources" name="inventory_sources[]" data-vv-as="&quot;{{ __('admin::app.settings.channels.inventory_sources') }}&quot;" multiple>
@foreach(app('Webkul\Inventory\Repositories\InventorySourceRepository')->all() as $inventorySource)
@foreach (app('Webkul\Inventory\Repositories\InventorySourceRepository')->all() as $inventorySource)
<option value="{{ $inventorySource->id }}" {{ in_array($inventorySource->id, $selectedOptionIds) ? 'selected' : '' }}>
{{ $inventorySource->name }}
</option>
@ -63,7 +63,7 @@
<label for="root_category_id" class="required">{{ __('admin::app.settings.channels.root-category') }}</label>
<?php $selectedOption = old('root_category_id') ?: $channel->root_category_id ?>
<select v-validate="'required'" class="control" id="root_category_id" name="root_category_id" data-vv-as="&quot;{{ __('admin::app.settings.channels.root-category') }}&quot;">
@foreach(app('Webkul\Category\Repositories\CategoryRepository')->getRootCategories() as $category)
@foreach (app('Webkul\Category\Repositories\CategoryRepository')->getRootCategories() as $category)
<option value="{{ $category->id }}" {{ $selectedOption == $category->id ? 'selected' : '' }}>
{{ $category->name }}
</option>
@ -87,7 +87,7 @@
<label for="locales" class="required">{{ __('admin::app.settings.channels.locales') }}</label>
<?php $selectedOptionIds = old('locales') ?: $channel->locales->pluck('id')->toArray() ?>
<select v-validate="'required'" class="control" id="locales" name="locales[]" data-vv-as="&quot;{{ __('admin::app.settings.channels.locales') }}&quot;" multiple>
@foreach(core()->getAllLocales() as $locale)
@foreach (core()->getAllLocales() as $locale)
<option value="{{ $locale->id }}" {{ in_array($locale->id, $selectedOptionIds) ? 'selected' : '' }}>
{{ $locale->name }}
</option>
@ -100,7 +100,7 @@
<label for="default_locale_id" class="required">{{ __('admin::app.settings.channels.default-locale') }}</label>
<?php $selectedOption = old('default_locale_id') ?: $channel->default_locale_id ?>
<select v-validate="'required'" class="control" id="default_locale_id" name="default_locale_id" data-vv-as="&quot;{{ __('admin::app.settings.channels.default-locale') }}&quot;">
@foreach(core()->getAllLocales() as $locale)
@foreach (core()->getAllLocales() as $locale)
<option value="{{ $locale->id }}" {{ $selectedOption == $locale->id ? 'selected' : '' }}>
{{ $locale->name }}
</option>
@ -113,7 +113,7 @@
<label for="currencies" class="required">{{ __('admin::app.settings.channels.currencies') }}</label>
<?php $selectedOptionIds = old('currencies') ?: $channel->currencies->pluck('id')->toArray() ?>
<select v-validate="'required'" class="control" id="currencies" name="currencies[]" data-vv-as="&quot;{{ __('admin::app.settings.channels.currencies') }}&quot;" multiple>
@foreach(core()->getAllCurrencies() as $currency)
@foreach (core()->getAllCurrencies() as $currency)
<option value="{{ $currency->id }}" {{ in_array($currency->id, $selectedOptionIds) ? 'selected' : '' }}>
{{ $currency->name }}
</option>
@ -126,7 +126,7 @@
<label for="base_currency_id" class="required">{{ __('admin::app.settings.channels.base-currency') }}</label>
<?php $selectedOption = old('base_currency_id') ?: $channel->base_currency_id ?>
<select v-validate="'required'" class="control" id="base_currency_id" name="base_currency_id" data-vv-as="&quot;{{ __('admin::app.settings.channels.base-currency') }}&quot;">
@foreach(core()->getAllCurrencies() as $currency)
@foreach (core()->getAllCurrencies() as $currency)
<option value="{{ $currency->id }}" {{ $selectedOption == $currency->id ? 'selected' : '' }}>
{{ $currency->name }}
</option>
@ -146,7 +146,7 @@
<?php $selectedOption = old('theme') ?: $channel->theme ?>
<select class="control" id="theme" name="theme">
@foreach(themes()->all() as $theme)
@foreach (themes()->all() as $theme)
<option value="{{ $theme->code }}" {{ $selectedOption == $theme->code ? 'selected' : '' }}>
{{ $theme->name }}
</option>

View File

@ -49,8 +49,8 @@
<td>
<div class="control-group" :class="[errors.has('target_currency') ? 'has-error' : '']">
<select v-validate="'required'" class="control" name="target_currency" data-vv-as="&quot;{{ __('admin::app.settings.exchange_rates.target_currency') }}&quot;">
@foreach($currencies as $currency)
@if(is_null($currency->CurrencyExchangeRate))
@foreach ($currencies as $currency)
@if (is_null($currency->CurrencyExchangeRate))
<option value="{{ $currency->id }}">{{ $currency->name }}</option>
@endif
@endforeach

View File

@ -50,7 +50,7 @@
<td>
<div class="control-group" :class="[errors.has('target_currency') ? 'has-error' : '']">
<select v-validate="'required'" class="control" name="target_currency" data-vv-as="&quot;{{ __('admin::app.settings.exchange_rates.target_currency') }}&quot;">
@foreach($currencies as $currency)
@foreach ($currencies as $currency)
<option value="{{ $currency->id }}" {{ $exchangeRate->target_currency == $currency->id ? 'selected' : '' }}>
{{ $currency->name }}
</option>

View File

@ -32,8 +32,8 @@
<div class="control-group" :class="[errors.has('channel_id') ? 'has-error' : '']">
<label for="channel_id">{{ __('admin::app.settings.sliders.channels') }}</label>
<select class="control" id="channel_id" name="channel_id" v-validate="'required'" data-vv-as="&quot;{{ __('admin::app.settings.sliders.channels') }}&quot;">
@foreach($channels as $channel)
<option value="{{ $channel->id }}" @if($channel->id == old('channel_id')) selected @endif>
@foreach ($channels as $channel)
<option value="{{ $channel->id }}" @if ($channel->id == old('channel_id')) selected @endif>
{{ __($channel->name) }}
</option>
@endforeach

View File

@ -34,8 +34,8 @@
<div class="control-group" :class="[errors.has('channel_id') ? 'has-error' : '']">
<label for="channel_id">{{ __('admin::app.settings.sliders.channels') }}</label>
<select class="control" id="channel_id" name="channel_id" data-vv-as="&quot;{{ __('admin::app.settings.sliders.channels') }}&quot;" value="" v-validate="'required'">
@foreach($channels as $channel)
<option value="{{ $channel->id }}" @if($channel->id == $slider->channel_id) selected @endif>
@foreach ($channels as $channel)
<option value="{{ $channel->id }}" @if ($channel->id == $slider->channel_id) selected @endif>
{{ __($channel->name) }}
</option>
@endforeach

View File

@ -26,7 +26,7 @@
<label for="channel" class="required">{{ __('admin::app.configuration.tax-categories.select-channel') }}</label>
<select class="control" name="channel_id">
@foreach(core()->getAllChannels() as $channelModel)
@foreach (core()->getAllChannels() as $channelModel)
<option value="{{ $channelModel->id }}">
{{ $channelModel->name }}
@ -66,7 +66,7 @@
<label for="taxrates" class="required">{{ __('admin::app.configuration.tax-categories.select-taxrates') }}</label>
<select multiple="multiple" v-validate="'required'" class="control" id="taxrates" name="taxrates[]" data-vv-as="&quot;{{ __('admin::app.configuration.tax-categories.select-taxrates') }}&quot;" value="{{ old('taxrates') }}">
@foreach($taxRates as $taxRate)
@foreach ($taxRates as $taxRate)
<option value="{{ $taxRate['id'] }}">{{ $taxRate['identifier'] }}</option>
@endforeach
</select>

View File

@ -27,9 +27,9 @@
<label for="channel" class="required">{{ __('admin::app.settings.tax-categories.select-channel') }}</label>
<select class="control" name="channel_id">
@foreach(core()->getAllChannels() as $channelModel)
@foreach (core()->getAllChannels() as $channelModel)
<option @if($taxCategory->channel_id == $channelModel->id) selected @endif value="{{ $channelModel->id }}">
<option @if ($taxCategory->channel_id == $channelModel->id) selected @endif value="{{ $channelModel->id }}">
{{ $channelModel->name }}
</option>
@ -57,7 +57,7 @@
@inject('taxRates', 'Webkul\Tax\Repositories\TaxRateRepository')
<select multiple="multiple" class="control" id="taxrates" name="taxrates[]" data-vv-as="&quot;{{ __('admin::app.settings.tax-categories.select-taxrates') }}&quot;" v-validate="'required'">
@foreach($taxRates->all() as $taxRate)
@foreach ($taxRates->all() as $taxRate)
<option value="{{ $taxRate->id }}" {{ is_numeric($taxCategory->tax_rates->pluck('id')->search($taxRate->id)) ? 'selected' : '' }}>{{ $taxRate->identifier }}</option>
@endforeach
</select>

View File

@ -64,7 +64,7 @@
<script>
$(document).ready(function () {
$('#permission_type').on('change', function(e) {
if($(e.target).val() == 'custom') {
if ($(e.target).val() == 'custom') {
$('.tree-container').removeClass('hide')
} else {
$('.tree-container').addClass('hide')

View File

@ -66,7 +66,7 @@
<script>
$(document).ready(function () {
$('#permission_type').on('change', function(e) {
if($(e.target).val() == 'custom') {
if ($(e.target).val() == 'custom') {
$('.tree-wrapper').removeClass('hide')
} else {
$('.tree-wrapper').addClass('hide')

View File

@ -60,7 +60,7 @@
<div class="control-group" :class="[errors.has('role_id') ? 'has-error' : '']">
<label for="role" class="required">{{ __('admin::app.users.users.role') }}</label>
<select v-validate="'required'" class="control" name="role_id" data-vv-as="&quot;{{ __('admin::app.users.users.role') }}&quot;">
@foreach($roles as $role)
@foreach ($roles as $role)
<option value="{{ $role->id }}">{{ $role->name }}</option>
@endforeach
</select>

View File

@ -61,7 +61,7 @@
<div class="control-group" :class="[errors.has('role_id') ? 'has-error' : '']">
<label for="role" class="required">{{ __('admin::app.users.users.role') }}</label>
<select v-validate="'required'" class="control" name="role_id" data-vv-as="&quot;{{ __('admin::app.users.users.role') }}&quot;">
@foreach($roles as $role)
@foreach ($roles as $role)
<option value="{{ $role->id }}" {{ $user->role_id == $role->id ? 'selected' : '' }}>{{ $role->name }}</option>
@endforeach
</select>
@ -72,7 +72,7 @@
<label for="status">{{ __('admin::app.users.users.status') }}</label>
<span class="checkbox">
<input type="checkbox" id="status" name="status"
{{-- @if($user->status == 0)
{{-- @if ($user->status == 0)
value="false"
@else
value="true"

View File

@ -127,7 +127,7 @@ class AttributeController extends Controller
{
$attribute = $this->attribute->findOrFail($id);
if(!$attribute->is_user_defined) {
if (!$attribute->is_user_defined) {
session()->flash('error', 'Can not delete system attribute.');
} else {
try {
@ -158,7 +158,7 @@ class AttributeController extends Controller
$attribute = $this->attribute->findOrFail($value);
try {
if (!$attribute->is_user_defined) {
if (! $attribute->is_user_defined) {
continue;
} else {
$this->attribute->delete($value);
@ -170,7 +170,7 @@ class AttributeController extends Controller
}
}
if (!$suppressFlash)
if (! $suppressFlash)
session()->flash('success', trans('admin::app.datagrid.mass-ops.delete-success', ['resource' => 'attributes']));
else
session()->flash('info', trans('admin::app.datagrid.mass-ops.partial-action', ['resource' => 'attributes']));

View File

@ -168,7 +168,7 @@ class AttributeFamilyController extends Controller
}
}
if (!$suppressFlash)
if (! $suppressFlash)
session()->flash('success', ('admin::app.datagrid.mass-ops.delete-success'));
else
session()->flash('info', trans('admin::app.datagrid.mass-ops.partial-action', ['resource' => 'Attribute Family']));

View File

@ -74,7 +74,7 @@ class AttributeFamilyRepository extends Repository
$attributeGroup = $family->attribute_groups()->create($group);
foreach ($custom_attributes as $key => $attribute) {
if(isset($attribute['id'])) {
if (isset($attribute['id'])) {
$attributeModel = $this->attribute->find($attribute['id']);
} else {
$attributeModel = $this->attribute->findOneByField('code', $attribute['code']);
@ -105,19 +105,19 @@ class AttributeFamilyRepository extends Repository
$previousAttributeGroupIds = $family->attribute_groups()->pluck('id');
if(isset($data['attribute_groups'])) {
if (isset($data['attribute_groups'])) {
foreach ($data['attribute_groups'] as $attributeGroupId => $attributeGroupInputs) {
if (str_contains($attributeGroupId, 'group_')) {
$attributeGroup = $family->attribute_groups()->create($attributeGroupInputs);
if(isset($attributeGroupInputs['custom_attributes'])) {
if (isset($attributeGroupInputs['custom_attributes'])) {
foreach ($attributeGroupInputs['custom_attributes'] as $key => $attribute) {
$attributeModel = $this->attribute->find($attribute['id']);
$attributeGroup->custom_attributes()->save($attributeModel, ['position' => $key + 1]);
}
}
} else {
if(is_numeric($index = $previousAttributeGroupIds->search($attributeGroupId))) {
if (is_numeric($index = $previousAttributeGroupIds->search($attributeGroupId))) {
$previousAttributeGroupIds->forget($index);
}
@ -126,9 +126,9 @@ class AttributeFamilyRepository extends Repository
$attributeIds = $attributeGroup->custom_attributes()->get()->pluck('id');
if(isset($attributeGroupInputs['custom_attributes'])) {
if (isset($attributeGroupInputs['custom_attributes'])) {
foreach ($attributeGroupInputs['custom_attributes'] as $key => $attribute) {
if(is_numeric($index = $attributeIds->search($attribute['id']))) {
if (is_numeric($index = $attributeIds->search($attribute['id']))) {
$attributeIds->forget($index);
} else {
$attributeModel = $this->attribute->find($attribute['id']);
@ -137,7 +137,7 @@ class AttributeFamilyRepository extends Repository
}
}
if($attributeIds->count()) {
if ($attributeIds->count()) {
$attributeGroup->custom_attributes()->detach($attributeIds);
}
}

View File

@ -59,7 +59,7 @@ class AttributeRepository extends Repository
unset($data['options']);
$attribute = $this->model->create($data);
if(in_array($attribute->type, ['select', 'multiselect', 'checkbox']) && count($options)) {
if (in_array($attribute->type, ['select', 'multiselect', 'checkbox']) && count($options)) {
foreach ($options as $option) {
$attribute->options()->create($option);
}
@ -88,13 +88,13 @@ class AttributeRepository extends Repository
$previousOptionIds = $attribute->options()->pluck('id');
if(in_array($attribute->type, ['select', 'multiselect', 'checkbox'])) {
if(isset($data['options'])) {
if (in_array($attribute->type, ['select', 'multiselect', 'checkbox'])) {
if (isset($data['options'])) {
foreach ($data['options'] as $optionId => $optionInputs) {
if (str_contains($optionId, 'option_')) {
$attribute->options()->create($optionInputs);
} else {
if(is_numeric($index = $previousOptionIds->search($optionId))) {
if (is_numeric($index = $previousOptionIds->search($optionId))) {
$previousOptionIds->forget($index);
}
@ -132,11 +132,11 @@ class AttributeRepository extends Repository
*/
public function validateUserInput($data)
{
if($data['is_configurable']) {
if ($data['is_configurable']) {
$data['value_per_channel'] = $data['value_per_locale'] = 0;
}
if(!in_array($data['type'], ['select', 'multiselect', 'price'])) {
if (! in_array($data['type'], ['select', 'multiselect', 'price'])) {
$data['is_filterable'] = 0;
}
@ -158,7 +158,7 @@ class AttributeRepository extends Repository
{
$attributeColumns = ['id', 'code', 'value_per_channel', 'value_per_locale', 'type', 'is_filterable'];
if(!is_array($codes) && !$codes)
if (! is_array($codes) && !$codes)
return $this->findWhereIn('code', [
'name',
'description',
@ -171,7 +171,7 @@ class AttributeRepository extends Repository
'status'
], $attributeColumns);
if(in_array('*', $codes))
if (in_array('*', $codes))
return $this->all($attributeColumns);
return $this->findWhereIn('code', $codes, $attributeColumns);

View File

@ -111,7 +111,7 @@ class CategoryController extends Controller
$this->validate(request(), [
$locale . '.slug' => ['required', new \Webkul\Core\Contracts\Validations\Slug, function ($attribute, $value, $fail) use ($id) {
if (!$this->category->isSlugUnique($id, $value)) {
if (! $this->category->isSlugUnique($id, $value)) {
$fail('The :attribute has already been taken.');
}
}],
@ -153,10 +153,10 @@ class CategoryController extends Controller
public function massDestroy() {
$suppressFlash = false;
if(request()->isMethod('delete')) {
if (request()->isMethod('delete')) {
$indexes = explode(',', request()->input('indexes'));
foreach($indexes as $key => $value) {
foreach ($indexes as $key => $value) {
try {
Event::fire('catalog.category.delete.before', $value);
@ -170,7 +170,7 @@ class CategoryController extends Controller
}
}
if(!$suppressFlash)
if (! $suppressFlash)
session()->flash('success', trans('admin::app.datagrid.mass-ops.delete-success'));
else
session()->flash('info', trans('admin::app.datagrid.mass-ops.partial-action', ['resource' => 'Attribute Family']));

View File

@ -137,7 +137,7 @@ class Cart {
];
//Authentication details
if(auth()->guard('customer')->check()) {
if (auth()->guard('customer')->check()) {
$cartData['customer_id'] = auth()->guard('customer')->user()->id;
$cartData['is_guest'] = 0;
$cartData['customer_first_name'] = auth()->guard('customer')->user()->first_name;
@ -151,8 +151,8 @@ class Cart {
$this->putCart($result);
if($result) {
if($item = $this->createItem($id, $data))
if ($result) {
if ($item = $this->createItem($id, $data))
return $item;
else
return false;
@ -172,10 +172,10 @@ class Cart {
public function add($id, $data) {
$cart = $this->getCart();
if($cart != null) {
if ($cart != null) {
$ifExists = $this->checkIfItemExists($id, $data);
if($ifExists) {
if ($ifExists) {
$item = $this->cartItem->findOneByField('id', $ifExists);
$data['quantity'] = $data['quantity'] + $item->quantity;
@ -199,14 +199,14 @@ class Cart {
public function checkIfItemExists($id, $data) {
$items = $this->getCart()->items;
foreach($items as $item) {
if($id == $item->product_id) {
foreach ($items as $item) {
if ($id == $item->product_id) {
$product = $this->product->findOnebyField('id', $id);
if($product->type == 'configurable') {
if ($product->type == 'configurable') {
$variant = $this->product->findOneByField('id', $data['selected_configurable_option']);
if($item->child->product_id == $data['selected_configurable_option']) {
if ($item->child->product_id == $data['selected_configurable_option']) {
return $item->id;
}
} else {
@ -228,8 +228,8 @@ class Cart {
$product = $parentProduct = $configurable = false;
$product = $this->product->findOneByField('id', $id);
if($product->type == 'configurable') {
if(!isset($data['selected_configurable_option'])) {
if ($product->type == 'configurable') {
if (! isset($data['selected_configurable_option'])) {
return false;
}
@ -237,7 +237,7 @@ class Cart {
$canAdd = $parentProduct->haveSufficientQuantity($data['quantity']);
if(!$canAdd) {
if (! $canAdd) {
session()->flash('warning', 'insuff qty');
return false;
@ -247,7 +247,7 @@ class Cart {
} else {
$canAdd = $product->haveSufficientQuantity($data['quantity']);
if(!$canAdd) {
if (! $canAdd) {
session()->flash('warning', 'insuff qty');
return false;
@ -255,12 +255,12 @@ class Cart {
}
//Check if the product's information is proper or not
if(!isset($data['product']) || !isset($data['quantity'])) {
if (! isset($data['product']) || !isset($data['quantity'])) {
session()->flash('error', trans('shop::app.checkout.cart.integrity.missing_fields'));
return false;
} else {
if($product->type == 'configurable' && !isset($data['super_attribute'])) {
if ($product->type == 'configurable' && !isset($data['super_attribute'])) {
session()->flash('error', trans('shop::app.checkout.cart.integrity.missing_options'));
return false;
@ -290,7 +290,7 @@ class Cart {
'additional' => $data,
];
if($configurable) {
if ($configurable) {
$attributeDetails = $this->getProductAttributeOptionDetails($parentProduct);
unset($attributeDetails['html']);
@ -330,10 +330,10 @@ class Cart {
$additional = $item->additional;
}
if($item->type == 'configurable') {
if ($item->type == 'configurable') {
$product = $this->product->findOneByField('id', $item->child->product_id);
if(!$product->haveSufficientQuantity($data['quantity'])) {
if (! $product->haveSufficientQuantity($data['quantity'])) {
session()->flash('warning', trans('shop::app.checkout.cart.quantity.inventory_warning'));
return false;
@ -346,7 +346,7 @@ class Cart {
} else {
$product = $this->product->findOneByField('id', $item->product_id);
if(!$product->haveSufficientQuantity($data['quantity'])) {
if (! $product->haveSufficientQuantity($data['quantity'])) {
session()->flash('warning', trans('shop::app.checkout.cart.quantity.inventory_warning'));
return false;
@ -366,7 +366,7 @@ class Cart {
$this->collectTotals();
if($result) {
if ($result) {
session()->flash('success', trans('shop::app.checkout.cart.quantity.success'));
return $item;
@ -384,15 +384,15 @@ class Cart {
*/
public function removeItem($itemId)
{
if($cart = $this->getCart()) {
if ($cart = $this->getCart()) {
$this->cartItem->delete($itemId);
//delete the cart instance if no items are there
if($cart->items()->get()->count() == 0) {
if ($cart->items()->get()->count() == 0) {
$this->cart->delete($cart->id);
// $this->deActivateCart();
if(session()->has('cart')) {
if (session()->has('cart')) {
session()->forget('cart');
}
}
@ -412,10 +412,10 @@ class Cart {
*/
public function mergeCart()
{
if(session()->has('cart')) {
if (session()->has('cart')) {
$cart = $this->cart->findWhere(['customer_id' => auth()->guard('customer')->user()->id, 'is_active' => 1]);
if($cart->count()) {
if ($cart->count()) {
$cart = $cart->first();
} else {
$cart = false;
@ -424,7 +424,7 @@ class Cart {
$guestCart = session()->get('cart');
//when the logged in customer is not having any of the cart instance previously and are active.
if(!$cart) {
if (! $cart) {
$guestCart->update([
'customer_id' => auth()->guard('customer')->user()->id,
'is_guest' => 0,
@ -444,17 +444,17 @@ class Cart {
$guestCartItems = $this->cart->findOneByField('id', $guestCartId)->items;
foreach($guestCartItems as $key => $guestCartItem) {
foreach($cartItems as $cartItem) {
foreach ($guestCartItems as $key => $guestCartItem) {
foreach ($cartItems as $cartItem) {
if($guestCartItem->type == "simple") {
if($cartItem->product_id == $guestCartItem->product_id) {
if ($guestCartItem->type == "simple") {
if ($cartItem->product_id == $guestCartItem->product_id) {
$prevQty = $cartItem->quantity;
$newQty = $guestCartItem->quantity;
$product = $this->product->findOneByField('id', $cartItem->product_id);
if(!$product->haveSufficientQuantity($prevQty + $newQty)) {
if (! $product->haveSufficientQuantity($prevQty + $newQty)) {
$this->cartItem->delete($guestCartItem->id);
continue;
}
@ -466,18 +466,18 @@ class Cart {
$guestCartItems->forget($key);
$this->cartItem->delete($guestCartItem->id);
}
} else if($guestCartItem->type == "configurable" && $cartItem->type == "configurable") {
} else if ($guestCartItem->type == "configurable" && $cartItem->type == "configurable") {
$guestCartItemChild = $guestCartItem->child;
$cartItemChild = $cartItem->child;
if($guestCartItemChild->product_id == $cartItemChild->product_id) {
if ($guestCartItemChild->product_id == $cartItemChild->product_id) {
$prevQty = $guestCartItem->quantity;
$newQty = $cartItem->quantity;
$product = $this->product->findOneByField('id', $cartItem->child->product_id);
if(!$product->haveSufficientQuantity($prevQty + $newQty)) {
if (! $product->haveSufficientQuantity($prevQty + $newQty)) {
$this->cartItem->delete($guestCartItem->id);
continue;
}
@ -495,9 +495,9 @@ class Cart {
}
//now handle the products that are not removed from the list of items in the guest cart.
foreach($guestCartItems as $guestCartItem) {
foreach ($guestCartItems as $guestCartItem) {
if($guestCartItem->type == "configurable") {
if ($guestCartItem->type == "configurable") {
$guestCartItem->update(['cart_id' => $cart->id]);
$guestCartItem->child->update(['cart_id' => $cart->id]);
@ -527,7 +527,7 @@ class Cart {
*/
public function putCart($cart)
{
if(!auth()->guard('customer')->check()) {
if (! auth()->guard('customer')->check()) {
session()->put('cart', $cart);
}
}
@ -551,8 +551,8 @@ class Cart {
$cart = $this->cart->find(session()->get('cart')->id);
}
// if($cart != null) {
// if($cart->items->count() == 0) {
// if ($cart != null) {
// if ($cart->items->count() == 0) {
// $this->cart->delete($cart->id);
// return false;
@ -594,7 +594,7 @@ class Cart {
$labels = [];
$attribute = $product->parent->super_attributes;
foreach($product->parent->super_attributes as $attribute) {
foreach ($product->parent->super_attributes as $attribute) {
$option = $attribute->options()->where('id', $product->{$attribute->code})->first();
$data['attributes'][$attribute->code] = [
@ -618,24 +618,24 @@ class Cart {
*/
public function saveCustomerAddress($data)
{
if(!$cart = $this->getCart())
if (! $cart = $this->getCart())
return false;
$billingAddress = $data['billing'];
$shippingAddress = $data['shipping'];
$billingAddress['cart_id'] = $shippingAddress['cart_id'] = $cart->id;
if($billingAddressModel = $cart->billing_address) {
if ($billingAddressModel = $cart->billing_address) {
$this->cartAddress->update($billingAddress, $billingAddressModel->id);
if($shippingAddressModel = $cart->shipping_address) {
if(isset($billingAddress['use_for_shipping']) && $billingAddress['use_for_shipping']) {
if ($shippingAddressModel = $cart->shipping_address) {
if (isset($billingAddress['use_for_shipping']) && $billingAddress['use_for_shipping']) {
$this->cartAddress->update($billingAddress, $shippingAddressModel->id);
} else {
$this->cartAddress->update($shippingAddress, $shippingAddressModel->id);
}
} else {
if(isset($billingAddress['use_for_shipping']) && $billingAddress['use_for_shipping']) {
if (isset($billingAddress['use_for_shipping']) && $billingAddress['use_for_shipping']) {
$this->cartAddress->create(array_merge($billingAddress, ['address_type' => 'shipping']));
} else {
$this->cartAddress->create(array_merge($shippingAddress, ['address_type' => 'shipping']));
@ -644,14 +644,14 @@ class Cart {
} else {
$this->cartAddress->create(array_merge($billingAddress, ['address_type' => 'billing']));
if(isset($billingAddress['use_for_shipping']) && $billingAddress['use_for_shipping']) {
if (isset($billingAddress['use_for_shipping']) && $billingAddress['use_for_shipping']) {
$this->cartAddress->create(array_merge($billingAddress, ['address_type' => 'shipping']));
} else {
$this->cartAddress->create(array_merge($shippingAddress, ['address_type' => 'shipping']));
}
}
if(auth()->guard('customer')->check()) {
if (auth()->guard('customer')->check()) {
$cart->customer_email = auth()->guard('customer')->user()->email;
$cart->customer_first_name = auth()->guard('customer')->user()->first_name;
$cart->customer_last_name = auth()->guard('customer')->user()->last_name;
@ -674,14 +674,14 @@ class Cart {
*/
public function saveShippingMethod($shippingMethodCode)
{
if(!$cart = $this->getCart())
if (! $cart = $this->getCart())
return false;
$cart->shipping_method = $shippingMethodCode;
$cart->save();
// foreach($cart->shipping_rates as $rate) {
// if($rate->method != $shippingMethodCode) {
// foreach ($cart->shipping_rates as $rate) {
// if ($rate->method != $shippingMethodCode) {
// $rate->delete();
// }
// }
@ -697,10 +697,10 @@ class Cart {
*/
public function savePaymentMethod($payment)
{
if(!$cart = $this->getCart())
if (! $cart = $this->getCart())
return false;
if($cartPayment = $cart->payment)
if ($cartPayment = $cart->payment)
$cartPayment->delete();
$cartPayment = new CartPayment;
@ -721,11 +721,11 @@ class Cart {
{
$validated = $this->validateItems();
if(!$validated) {
if (! $validated) {
return false;
}
if(!$cart = $this->getCart())
if (! $cart = $this->getCart())
return false;
$this->calculateItemsTax();
@ -745,13 +745,13 @@ class Cart {
$cart->base_tax_total = (float) $cart->base_tax_total + $item->base_tax_amount;
}
if($shipping = $cart->selected_shipping_rate) {
if ($shipping = $cart->selected_shipping_rate) {
$cart->grand_total = (float) $cart->grand_total + $shipping->price;
$cart->base_grand_total = (float) $cart->base_grand_total + $shipping->base_price;
}
$quantities = 0;
foreach($cart->items as $item) {
foreach ($cart->items as $item) {
$quantities = $quantities + $item->quantity;
}
@ -772,27 +772,27 @@ class Cart {
{
$cart = $this->getCart();
if(!$cart) {
if (! $cart) {
return false;
}
//rare case of accident-->used when there are no items.
if(count($cart->items) == 0) {
if (count($cart->items) == 0) {
$this->cart->delete($cart->id);
return false;
} else {
$items = $cart->items;
foreach($items as $item) {
if($item->product->type == 'configurable') {
if($item->product->sku != $item->sku) {
foreach ($items as $item) {
if ($item->product->type == 'configurable') {
if ($item->product->sku != $item->sku) {
$item->update(['sku' => $item->product->sku]);
} else if($item->product->name != $item->name) {
} else if ($item->product->name != $item->name) {
$item->update(['name' => $item->product->name]);
} else if($item->child->product->price != $item->price) {
} else if ($item->child->product->price != $item->price) {
$price = (float) $item->custom_price ? $item->custom_price : $item->child->product->price;
$item->update([
@ -803,14 +803,14 @@ class Cart {
]);
}
} else if($item->product->type == 'simple') {
if($item->product->sku != $item->sku) {
} else if ($item->product->type == 'simple') {
if ($item->product->sku != $item->sku) {
$item->update(['sku' => $item->product->sku]);
} else if($item->product->name != $item->name) {
} else if ($item->product->name != $item->name) {
$item->update(['name' => $item->product->name]);
} else if($item->product->price != $item->price) {
} else if ($item->product->price != $item->price) {
$price = (float) $item->custom_price ? $item->custom_price : $item->product->price;
$item->update([
@ -835,13 +835,13 @@ class Cart {
{
$cart = $this->getCart();
if(!$shippingAddress = $cart->shipping_address)
if (! $shippingAddress = $cart->shipping_address)
return;
foreach ($cart->items()->get() as $item) {
$taxCategory = $this->taxCategory->find($item->product->tax_category_id);
if(!$taxCategory)
if (! $taxCategory)
continue;
$taxRates = $taxCategory->tax_rates()->where([
@ -849,20 +849,20 @@ class Cart {
'country' => $shippingAddress->country,
])->orderBy('tax_rate', 'desc')->get();
foreach($taxRates as $rate) {
foreach ($taxRates as $rate) {
$haveTaxRate = false;
if(!$rate->is_zip) {
if($rate->zip_code == '*' || $rate->zip_code == $shippingAddress->postcode) {
if (! $rate->is_zip) {
if ($rate->zip_code == '*' || $rate->zip_code == $shippingAddress->postcode) {
$haveTaxRate = true;
}
} else {
if($shippingAddress->postcode >= $rate->zip_from && $shippingAddress->postcode <= $rate->zip_to) {
if ($shippingAddress->postcode >= $rate->zip_from && $shippingAddress->postcode <= $rate->zip_to) {
$haveTaxRate = true;
}
}
if($haveTaxRate) {
if ($haveTaxRate) {
$item->tax_percent = $rate->tax_rate;
$item->tax_amount = ($item->total * $rate->tax_rate) / 100;
$item->base_tax_amount = ($item->base_total * $rate->tax_rate) / 100;
@ -881,10 +881,10 @@ class Cart {
*/
public function hasError()
{
if(!$this->getCart())
if (! $this->getCart())
return true;
if(!$this->isItemsHaveSufficientQuantity())
if (! $this->isItemsHaveSufficientQuantity())
return true;
return false;
@ -898,7 +898,7 @@ class Cart {
public function isItemsHaveSufficientQuantity()
{
foreach ($this->getCart()->items as $item) {
if(!$this->isItemHaveQuantity($item))
if (! $this->isItemHaveQuantity($item))
return false;
}
@ -914,7 +914,7 @@ class Cart {
{
$product = $item->type == 'configurable' ? $item->child->product : $item->product;
if(!$product->haveSufficientQuantity($item->quantity))
if (! $product->haveSufficientQuantity($item->quantity))
return false;
return true;
@ -927,10 +927,10 @@ class Cart {
*/
public function deActivateCart()
{
if($cart = $this->getCart()) {
if ($cart = $this->getCart()) {
$this->cart->update(['is_active' => false], $cart->id);
if(session()->has('cart')) {
if (session()->has('cart')) {
session()->forget('cart');
}
}
@ -980,7 +980,7 @@ class Cart {
'channel' => core()->getCurrentChannel(),
];
foreach($data['items'] as $item) {
foreach ($data['items'] as $item) {
$finalData['items'][] = $this->prepareDataForOrderItem($item);
}
@ -1012,7 +1012,7 @@ class Cart {
'additional' => $data['additional'],
];
if(isset($data['child']) && $data['child']) {
if (isset($data['child']) && $data['child']) {
$finalData['child'] = $this->prepareDataForOrderItem($data['child']);
}
@ -1027,18 +1027,18 @@ class Cart {
public function moveToCart($wishlistItem) {
$product = $wishlistItem->product;
if($product->type == 'simple') {
if ($product->type == 'simple') {
$data['quantity'] = 1;
$data['product'] = $wishlistItem->product->id;
$result = $this->add($product->id, $data);
if($result) {
if ($result) {
return 1;
} else {
return 0;
}
} else if($product->type == 'configurable' && $product->parent_id == null) {
} else if ($product->type == 'configurable' && $product->parent_id == null) {
return -1;
}
}
@ -1057,9 +1057,9 @@ class Cart {
'customer_id' => auth()->guard('customer')->user()->id,
];
foreach($items as $item) {
if($item->id == $itemId) {
if(is_null($item['parent_id']) && $item['type'] == 'simple') {
foreach ($items as $item) {
if ($item->id == $itemId) {
if (is_null($item['parent_id']) && $item['type'] == 'simple') {
$wishlist['product_id'] = $item->product_id;
} else {
$wishlist['product_id'] = $item->child->product_id;
@ -1068,14 +1068,14 @@ class Cart {
$shouldBe = $this->wishlist->findWhere(['customer_id' => auth()->guard('customer')->user()->id, 'product_id' => $wishlist['product_id']]);
if($shouldBe->isEmpty()) {
if ($shouldBe->isEmpty()) {
$wishlist = $this->wishlist->create($wishlist);
}
$result = $this->cartItem->delete($itemId);
if($result) {
if($cart->items()->count() == 0)
if ($result) {
if ($cart->items()->count() == 0)
$this->cart->delete($cart->id);
session()->flash('success', trans('shop::app.checkout.cart.move-to-wishlist-success'));
@ -1098,14 +1098,14 @@ class Cart {
public function proceedToBuyNow($id) {
$product = $this->product->findOneByField('id', $id);
if($product->type == 'configurable') {
if ($product->type == 'configurable') {
session()->flash('warning', trans('shop::app.buynow.no-options'));
return false;
} else {
$simpleOrVariant = $this->product->find($id);
if($simpleOrVariant->parent_id != null) {
if ($simpleOrVariant->parent_id != null) {
$parent = $simpleOrVariant->parent;
$data['product'] = $parent->id;

View File

@ -38,7 +38,7 @@ class CustomerAddressForm extends FormRequest
'billing.country' => ['required']
];
if(isset($this->get('billing')['use_for_shipping']) && !$this->get('billing')['use_for_shipping']) {
if (isset($this->get('billing')['use_for_shipping']) && !$this->get('billing')['use_for_shipping']) {
$this->rules = array_merge($this->rules, [
'shipping.first_name' => ['required'],
'shipping.last_name' => ['required'],

View File

@ -109,7 +109,7 @@ class Core
{
static $channels;
if($channels)
if ($channels)
return $channels;
return $channels = $this->channelRepository->all();
@ -124,7 +124,7 @@ class Core
{
static $channel;
if($channel)
if ($channel)
return $channel;
$channel = $this->channelRepository->findWhereIn('hostname', [
@ -133,7 +133,7 @@ class Core
'https://' . request()->getHttpHost()
])->first();
if(!$channel)
if (! $channel)
$channel = $this->channelRepository->first();
return $channel;
@ -148,7 +148,7 @@ class Core
{
static $channelCode;
if($channelCode)
if ($channelCode)
return $channelCode;
return ($channel = $this->getCurrentChannel()) ? $channelCode = $channel->code : '';
@ -163,7 +163,7 @@ class Core
{
static $channel;
if($channel)
if ($channel)
return $channel;
return $channel = $this->channelRepository->first();
@ -178,7 +178,7 @@ class Core
{
static $channelCode;
if($channelCode)
if ($channelCode)
return $channelCode;
return ($channel = $this->getDefaultChannel()) ? $channelCode = $channel->code : '';
@ -193,7 +193,7 @@ class Core
{
static $locales;
if($locales)
if ($locales)
return $locales;
return $locales = $this->localeRepository->all();
@ -208,7 +208,7 @@ class Core
{
static $currencies;
if($currencies)
if ($currencies)
return $currencies;
return $currencies = $this->currencyRepository->all();
@ -223,12 +223,12 @@ class Core
{
static $currency;
if($currency)
if ($currency)
return $currency;
$baseCurrency = $this->currencyRepository->findOneByField('code', config('app.currency'));
if(!$baseCurrency)
if (! $baseCurrency)
$baseCurrency = $this->currencyRepository->first();
return $currency = $baseCurrency;
@ -243,7 +243,7 @@ class Core
{
static $currencyCode;
if($currencyCode)
if ($currencyCode)
return $currencyCode;
return ($currency = $this->getBaseCurrency()) ? $currencyCode = $currency->code : '';
@ -258,7 +258,7 @@ class Core
{
static $currency;
if($currency)
if ($currency)
return $currency;
$currenctChannel = $this->getCurrentChannel();
@ -275,7 +275,7 @@ class Core
{
static $currencyCode;
if($currencyCode)
if ($currencyCode)
return $currencyCode;
return ($currency = $this->getChannelBaseCurrency()) ? $currencyCode = $currency->code : '';
@ -290,11 +290,11 @@ class Core
{
static $currency;
if($currency)
if ($currency)
return $currency;
if($currencyCode = session()->get('currency')) {
if($currency = $this->currencyRepository->findOneByField('code', $currencyCode))
if ($currencyCode = session()->get('currency')) {
if ($currency = $this->currencyRepository->findOneByField('code', $currencyCode))
return $currency;
}
@ -310,7 +310,7 @@ class Core
{
static $currencyCode;
if($currencyCode)
if ($currencyCode)
return $currencyCode;
return ($currency = $this->getCurrentCurrency()) ? $currencyCode = $currency->code : '';
@ -329,7 +329,7 @@ class Core
? $this->getCurrentCurrency()
: $this->currencyRepository->findByField('code', $targetCurrencyCode);
if(!$targetCurrency)
if (! $targetCurrency)
return $amount;
$exchangeRate = $this->exchangeRateRepository->findOneWhere([
@ -350,7 +350,7 @@ class Core
*/
public function currency($amount = 0)
{
if(is_null($amount))
if (is_null($amount))
$amount = 0;
$currencyCode = $this->getCurrentCurrency()->code;
@ -381,7 +381,7 @@ class Core
*/
public function formatPrice($price, $currencyCode)
{
if(is_null($price))
if (is_null($price))
$price = 0;
return currency($price, $currencyCode);
@ -395,7 +395,7 @@ class Core
*/
public function formatBasePrice($price)
{
if(is_null($price))
if (is_null($price))
$price = 0;
return currency($price, $this->getBaseCurrencyCode());
@ -425,8 +425,8 @@ class Core
$result = false;
if (!$this->is_empty_date($dateFrom) && $channelTimeStamp < $fromTimeStamp) {
} elseif (!$this->is_empty_date($dateTo) && $channelTimeStamp > $toTimeStamp) {
if (! $this->is_empty_date($dateFrom) && $channelTimeStamp < $fromTimeStamp) {
} elseif (! $this->is_empty_date($dateTo) && $channelTimeStamp > $toTimeStamp) {
} else {
$result = true;
}
@ -544,7 +544,7 @@ class Core
}
}
if (!$coreConfigValue) {
if (! $coreConfigValue) {
$fields = explode(".", $field);
array_shift($fields);
$field = implode(".", $fields);
@ -606,7 +606,7 @@ class Core
$endWeekDay = Carbon::createFromTimeString($this->xWeekRange($endDate, 1) . ' 23:59:59');
$totalWeeks = $startWeekDay->diffInWeeks($endWeekDay);
if($totalMonths > 5) {
if ($totalMonths > 5) {
for ($i = 0; $i < $totalMonths; $i++) {
$date = clone $startDate;
$date->addMonths($i);
@ -618,7 +618,7 @@ class Core
$timeIntervals[] = ['start' => $start, 'end' => $end, 'formatedDate' => $date->format('M')];
}
} elseif($totalWeeks > 6) {
} else if ($totalWeeks > 6) {
for ($i = 0; $i < $totalWeeks; $i++) {
$date = clone $startDate;
$date->addWeeks($i);
@ -653,7 +653,7 @@ class Core
public function xWeekRange($date, $day) {
$ts = strtotime($date);
if(!$day) {
if (! $day) {
$start = (date('D', $ts) == 'Sun') ? $ts : strtotime('last sunday', $ts);
return date('Y-m-d', $start);
@ -671,7 +671,7 @@ class Core
*/
public function sortItems($items) {
foreach ($items as &$item) {
if(count($item['children'])) {
if (count($item['children'])) {
$item['children'] = $this->sortItems($item['children']);
}
}
@ -711,14 +711,14 @@ class Core
unset($items[$key1]);
$items[$level1['key']] = $level1;
if(count($level1['children'])) {
if (count($level1['children'])) {
foreach ($level1['children'] as $key2 => $level2) {
$temp2 = explode('.', $level2['key']);
$finalKey2 = end($temp2);
unset($items[$level1['key']]['children'][$key2]);
$items[$level1['key']]['children'][$finalKey2] = $level2;
if(count($level2['children'])) {
if (count($level2['children'])) {
foreach ($level2['children'] as $key3 => $level3) {
$temp3 = explode('.', $level3['key']);
$finalKey3 = end($temp3);
@ -754,7 +754,7 @@ class Core
}
$finalKey = array_shift($keys);
if(isset($array[$finalKey])) {
if (isset($array[$finalKey])) {
$array[$finalKey] = $this->arrayMerge($array[$finalKey], $value);
} else {
$array[$finalKey] = $value;

View File

@ -18,10 +18,10 @@ class TranslatableModel extends Model
protected function isKeyALocale($key)
{
$chunks = explode('-', $key);
if(count($chunks) > 1) {
if(Locale::where('code', '=', end($chunks))->first())
if (count($chunks) > 1) {
if (Locale::where('code', '=', end($chunks))->first())
return true;
} elseif(Locale::where('code', '=', $key)->first()) {
} else if (Locale::where('code', '=', $key)->first()) {
return true;
}
@ -33,7 +33,7 @@ class TranslatableModel extends Model
*/
protected function locale()
{
if($this->isChannelBased()) {
if ($this->isChannelBased()) {
return core()->getDefaultChannelLocaleCode();
} else {
if ($this->defaultLocale) {

View File

@ -147,7 +147,7 @@ class ChannelController extends Controller
*/
public function destroy($id)
{
if($this->channel->count() == 1) {
if ($this->channel->count() == 1) {
session()->flash('error', 'At least one channel is required.');
} else {
Event::fire('core.channel.delete.before', $id);

View File

@ -63,9 +63,9 @@ class CountryStateController extends Controller
$nestedArray = [];
foreach($countries as $keyCountry => $country) {
foreach($states as $keyState => $state) {
if($country->code == $state->country_code) {
foreach ($countries as $keyCountry => $country) {
foreach ($states as $keyState => $state) {
if ($country->code == $state->country_code) {
$nestedArray[$country->name][$state->code] = $state->default_name;
}
}
@ -81,9 +81,9 @@ class CountryStateController extends Controller
$nestedArray = [];
foreach($countries as $keyCountry => $country) {
foreach($states as $keyState => $state) {
if($country->code == $state->country_code) {
foreach ($countries as $keyCountry => $country) {
foreach ($states as $keyState => $state) {
if ($country->code == $state->country_code) {
$nestedArray[$country->name][$state->code] = $state->default_name;
}
}

View File

@ -139,7 +139,7 @@ class CurrencyController extends Controller
Event::fire('core.currency.delete.after', $id);
if($result)
if ($result)
session()->flash('success', 'Currency deleted successfully.');
else
session()->flash('error', 'At least one currency is required.');
@ -158,10 +158,10 @@ class CurrencyController extends Controller
public function massDestroy() {
$suppressFlash = false;
if(request()->isMethod('post')) {
if (request()->isMethod('post')) {
$indexes = explode(',', request()->input('indexes'));
foreach($indexes as $key => $value) {
foreach ($indexes as $key => $value) {
try {
Event::fire('core.currency.delete.before', $value);
@ -175,7 +175,7 @@ class CurrencyController extends Controller
}
}
if(!$suppressFlash)
if (! $suppressFlash)
session()->flash('success', trans('admin::app.datagrid.mass-ops.delete-success', ['resource' => 'currencies']));
else
session()->flash('info', trans('admin::app.datagrid.mass-ops.partial-action', ['resource' => 'currencies']));

View File

@ -147,7 +147,7 @@ class ExchangeRateController extends Controller
*/
public function destroy($id)
{
if($this->exchangeRate->count() == 1) {
if ($this->exchangeRate->count() == 1) {
session()->flash('error', 'At least one Exchange rate is required.');
} else {
Event::fire('core.exchange_rate.delete.before', $id);

View File

@ -132,7 +132,7 @@ class LocaleController extends Controller
*/
public function destroy($id)
{
if($this->locale->count() == 1) {
if ($this->locale->count() == 1) {
session()->flash('error', 'At least one locale is required.');
} else {
Event::fire('core.locale.delete.before', $id);

View File

@ -71,7 +71,7 @@ class SubscriptionController extends Controller
$result = $subscriber->update($data);
if($result)
if ($result)
session()->flash('success', trans('admin::app.customers.subscribers.update-success'));
// session()->flash('success', 'admin::app.customers.subscribers.delete-success');
else
@ -88,7 +88,7 @@ class SubscriptionController extends Controller
*/
public function destroy($id)
{
if($this->subscribers->delete($id))
if ($this->subscribers->delete($id))
session()->flash('success', trans('admin::app.customers.subscribers.delete'));
else
session()->flash('error', trans('admin::app.customers.subscribers.delete-failed'));

View File

@ -19,18 +19,18 @@
}
if (empty($results)) {
foreach($values as $value) {
foreach ($values as $value) {
$results[] = [$key => $value];
}
} else {
$append = [];
foreach($results as &$result) {
foreach ($results as &$result) {
$result[$key] = array_shift($values);
$copy = $result;
foreach($values as $item) {
foreach ($values as $item) {
$copy[$key] = $item;
$append[] = $copy;
}

View File

@ -69,7 +69,7 @@ class Channel extends Model
*/
public function logo_url()
{
if(!$this->logo)
if (! $this->logo)
return;
return Storage::url($this->logo);
@ -88,7 +88,7 @@ class Channel extends Model
*/
public function favicon_url()
{
if(!$this->favicon)
if (! $this->favicon)
return;
return Storage::url($this->favicon);

View File

@ -77,13 +77,13 @@ class ChannelRepository extends Repository
public function uploadImages($data, $channel, $type = "logo")
{
if(isset($data[$type])) {
if (isset($data[$type])) {
foreach ($data[$type] as $imageId => $image) {
$file = $type . '.' . $imageId;
$dir = 'channel/' . $channel->id;
if(request()->hasFile($file)) {
if($channel->{$type}) {
if (request()->hasFile($file)) {
if ($channel->{$type}) {
Storage::delete($channel->{$type});
}
@ -92,7 +92,7 @@ class ChannelRepository extends Repository
}
}
} else {
if($channel->{$type}) {
if ($channel->{$type}) {
Storage::delete($channel->{$type});
}

View File

@ -86,7 +86,7 @@ class CoreConfigRepository extends Repository
}
}
if (!count($coreConfigValue) > 0) {
if (! count($coreConfigValue) > 0) {
$this->model->create([
'code' => $fieldName,
'value' => $value,
@ -122,19 +122,19 @@ class CoreConfigRepository extends Repository
$dim = $this->countDim($formValue);
if ($dim > 1) {
$this->recuressiveArray($formValue, $value);
} else if($dim == 1) {
} else if ($dim == 1) {
$data[$value] = $formValue;
}
}
}
foreach($data as $key => $value) {
foreach ($data as $key => $value) {
$field = core()->getConfigField($key);
if ($field) {
$recuressiveArrayData[$key] = $value;
} else {
foreach($value as $key1 => $val) {
foreach ($value as $key1 => $val) {
$recuressiveArrayData[$key . '.' . $key1] = $val;
}
}

View File

@ -23,10 +23,10 @@ class CurrencyRepository extends Repository
}
public function delete($id) {
if($this->model->count() == 1) {
if ($this->model->count() == 1) {
return false;
} else {
if($this->model->destroy($id)) {
if ($this->model->destroy($id)) {
return true;
} else {
return false;

View File

@ -50,22 +50,22 @@ class SliderRepository extends Repository
$uploaded = false;
$image = false;
if(isset($data['image'])) {
if (isset($data['image'])) {
$image = $first = array_first($data['image'], function ($value, $key) {
if($value)
if ($value)
return $value;
else
return false;
});
}
if($image != false) {
if ($image != false) {
$uploaded = $image->store($dir);
unset($data['image'], $data['_token']);
}
if($uploaded) {
if ($uploaded) {
$data['path'] = $uploaded;
} else {
unset($data['image']);
@ -87,22 +87,22 @@ class SliderRepository extends Repository
$uploaded = false;
$image = false;
if(isset($data['image'])) {
if (isset($data['image'])) {
$image = $first = array_first($data['image'], function ($value, $key) {
if($value)
if ($value)
return $value;
else
return false;
});
}
if($image != false) {
if ($image != false) {
$uploaded = $image->store($dir);
unset($data['image'], $data['_token']);
}
if($uploaded) {
if ($uploaded) {
$sliderItem = $this->find($id);
$deleted = Storage::delete($sliderItem->path);

View File

@ -59,7 +59,7 @@ class Tree {
public static function create($callback = null) {
$tree = new Tree();
if($callback) {
if ($callback) {
$callback($tree);
}

View File

@ -84,11 +84,11 @@ class AddressController extends Controller
$cust_id['customer_id'] = $this->customer->id;
$data = array_merge($cust_id, $data);
if($this->customer->addresses->count() == 0) {
if ($this->customer->addresses->count() == 0) {
$data['default_address'] = 1;
}
if($this->address->create($data)) {
if ($this->address->create($data)) {
session()->flash('success', 'Address have been successfully added.');
return redirect()->route($this->_config['redirect']);
@ -143,11 +143,11 @@ class AddressController extends Controller
*/
public function makeDefault($id)
{
if($default = $this->customer->default_address) {
if ($default = $this->customer->default_address) {
$this->address->find($default->id)->update(['default_address' => 0]);
}
if($address = $this->address->find($id)) {
if ($address = $this->address->find($id)) {
$address->update(['default_address' => 1]);
} else {
session()->flash('success', 'Default Cannot Be Address Changed');

View File

@ -105,18 +105,18 @@ class CustomerController extends Controller
$data = collect(request()->input())->except('_token')->toArray();
if($data['date_of_birth'] == "") {
if ($data['date_of_birth'] == "") {
unset($data['date_of_birth']);
}
if($data['oldpassword'] == null) {
if ($data['oldpassword'] == null) {
$data = collect(request()->input())->except(['_token','password','password_confirmation','oldpassword'])->toArray();
if($data['date_of_birth'] == "") {
if ($data['date_of_birth'] == "") {
unset($data['date_of_birth']);
}
if($this->customer->update($data, $id)) {
if ($this->customer->update($data, $id)) {
Session()->flash('success', trans('shop::app.customer.account.profile.edit-success'));
return redirect()->back();
@ -126,12 +126,12 @@ class CustomerController extends Controller
return redirect()->back();
}
} else {
if(Hash::check($data['oldpassword'], auth()->guard('customer')->user()->password)) {
if (Hash::check($data['oldpassword'], auth()->guard('customer')->user()->password)) {
$data = collect(request()->input())->except(['_token','oldpassword'])->toArray();
$data['password'] = bcrypt($data['password']);
if($data['date_of_birth'] == "") {
if ($data['date_of_birth'] == "") {
unset($data['date_of_birth']);
}
} else {
@ -140,7 +140,7 @@ class CustomerController extends Controller
return redirect()->back();
}
if($this->customer->update($data, $id)) {
if ($this->customer->update($data, $id)) {
Session()->flash('success', trans('shop::app.customer.account.profile.edit-success'));
return redirect()->back();

View File

@ -60,7 +60,7 @@ class ForgotPasswordController extends Controller
request(['email'])
);
//dd($response);
if($response == Password::RESET_LINK_SENT) {
if ($response == Password::RESET_LINK_SENT) {
session()->flash('success', trans($response));
return back();

View File

@ -109,7 +109,7 @@ class RegistrationController extends Controller
{
$customer = $this->customer->findOneByField('token', $token);
if($customer) {
if ($customer) {
$customer->update(['is_verified' => 1, 'token' => 'NULL']);
session()->flash('success', trans('shop::app.customer.signup-form.verified'));
@ -132,11 +132,11 @@ class RegistrationController extends Controller
try {
Mail::send(new VerificationEmail($verificationData));
if(Cookie::has('enable-resend')) {
if (Cookie::has('enable-resend')) {
\Cookie::queue(\Cookie::forget('enable-resend'));
}
if(Cookie::has('email-for-resend')) {
if (Cookie::has('email-for-resend')) {
\Cookie::queue(\Cookie::forget('email-for-resend'));
}
} catch(\Exception $e) {

View File

@ -74,7 +74,7 @@ class ResetPasswordController extends Controller
}
);
if($response == Password::PASSWORD_RESET) {
if ($response == Password::PASSWORD_RESET) {
return redirect()->route($this->_config['redirect']);
}

View File

@ -38,7 +38,7 @@ class SessionController extends Controller
public function show()
{
if(auth()->guard('customer')->check()) {
if (auth()->guard('customer')->check()) {
return redirect()->route('customer.session.index');
} else {
return view($this->_config['view']);
@ -52,13 +52,13 @@ class SessionController extends Controller
'password' => 'required'
]);
if (!auth()->guard('customer')->attempt(request(['email', 'password']))) {
if (! auth()->guard('customer')->attempt(request(['email', 'password']))) {
session()->flash('error', trans('shop::app.customer.login-form.invalid-creds'));
return redirect()->back();
}
if(auth()->guard('customer')->user()->is_verified == 0) {
if (auth()->guard('customer')->user()->is_verified == 0) {
session()->flash('info', trans('shop::app.customer.login-form.verify-first'));
Cookie::queue(Cookie::make('enable-resend', 'true', 1));

View File

@ -76,13 +76,13 @@ class WishlistController extends Controller
$checked = $this->wishlist->findWhere(['channel_id' => core()->getCurrentChannel()->id, 'product_id' => $itemId, 'customer_id' => auth()->guard('customer')->user()->id]);
//accidental case if some one adds id of the product in the anchor tag amd gives id of a variant.
if($product->parent_id != null) {
if ($product->parent_id != null) {
$product = $this->product->findOneByField('id', $product->parent_id);
$data['product_id'] = $product->parent_id;
}
if($checked->isEmpty()) {
if($this->wishlist->create($data)) {
if ($checked->isEmpty()) {
if ($this->wishlist->create($data)) {
session()->flash('success', trans('customer::app.wishlist.success'));
return redirect()->back();
@ -106,7 +106,7 @@ class WishlistController extends Controller
public function remove($itemId) {
$result = $this->wishlist->deleteWhere(['customer_id' => auth()->guard('customer')->user()->id, 'channel_id' => core()->getCurrentChannel()->id, 'id' => $itemId]);
if($result) {
if ($result) {
session()->flash('success', trans('customer::app.wishlist.removed'));
return redirect()->back();
@ -126,8 +126,8 @@ class WishlistController extends Controller
$wishlistItem = $this->wishlist->findOneByField('id', $itemId);
$result = Cart::moveToCart($wishlistItem);
if($result == 1) {
if($wishlistItem->delete()) {
if ($result == 1) {
if ($wishlistItem->delete()) {
session()->flash('success', trans('shop::app.wishlist.moved'));
Cart::collectTotals();
@ -138,12 +138,12 @@ class WishlistController extends Controller
return redirect()->back();
}
} else if($result == 0) {
} else if ($result == 0) {
Session('error', trans('shop::app.wishlist.error'));
return redirect()->back();
} else if($result == -1) {
if(!$wishlistItem->delete()) {
} else if ($result == -1) {
if (! $wishlistItem->delete()) {
session()->flash('error', trans('shop::app.wishlist.move-error'));
return redirect()->back();
@ -163,8 +163,8 @@ class WishlistController extends Controller
public function removeAll() {
$wishlistItems = auth()->guard('customer')->user()->wishlist_items;
if($wishlistItems->count() > 0) {
foreach($wishlistItems as $wishlistItem) {
if ($wishlistItems->count() > 0) {
foreach ($wishlistItems as $wishlistItem) {
$this->wishlist->delete($wishlistItem->id);
}
}

View File

@ -155,7 +155,7 @@ class InventorySourceController extends Controller
*/
public function destroy($id)
{
if($this->inventorySource->count() == 1) {
if ($this->inventorySource->count() == 1) {
session()->flash('error', 'At least one inventory source is required.');
} else {
Event::fire('inventory.inventory_source.delete.before', $id);

View File

@ -19,7 +19,7 @@ class Payment
foreach (Config::get('paymentmethods') as $paymentMethod) {
$object = app($paymentMethod['class']);
if($object->isAvailable()) {
if ($object->isAvailable()) {
$paymentMethods[] = [
'method' => $object->getCode(),
'method_title' => $object->getTitle(),

View File

@ -80,7 +80,7 @@ abstract class Payment
*/
public function setCart()
{
if(!$this->cart)
if (! $this->cart)
$this->cart = Cart::getCart();
}
@ -91,7 +91,7 @@ abstract class Payment
*/
public function getCart()
{
if(!$this->cart)
if (! $this->cart)
$this->setCart();
return $this->cart;
@ -104,7 +104,7 @@ abstract class Payment
*/
public function getCartItems()
{
if(!$this->cart)
if (! $this->cart)
$this->setCart();
return $this->cart->items;

View File

@ -68,7 +68,7 @@ class Ipn
{
$this->post = $post;
if(!$this->postBack())
if (! $this->postBack())
return;
try {
@ -105,13 +105,13 @@ class Ipn
*/
protected function processOrder()
{
if($this->post['payment_status'] == 'completed') {
if($this->post['mc_gross'] != $this->order->grand_total) {
if ($this->post['payment_status'] == 'completed') {
if ($this->post['mc_gross'] != $this->order->grand_total) {
} else {
$this->orderRepository->update(['status' => 'processing'], $this->order->id);
if($this->order->canInvoice()) {
if ($this->order->canInvoice()) {
$this->invoiceRepository->create($this->prepareInvoiceData());
}
}
@ -144,7 +144,7 @@ class Ipn
*/
protected function postBack()
{
if(array_key_exists('test_ipn', $this->post) && 1 === (int) $this->post['test_ipn'])
if (array_key_exists('test_ipn', $this->post) && 1 === (int) $this->post['test_ipn'])
$url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
else
$url = 'https://www.paypal.com/cgi-bin/webscr';
@ -167,7 +167,7 @@ class Ipn
// Close connection
curl_close($request);
if($status == 200 && $response == 'VERIFIED') {
if ($status == 200 && $response == 'VERIFIED') {
return true;
}

View File

@ -38,7 +38,7 @@ class ActiveProductCriteria extends AbstractProduct implements CriteriaInterface
*/
public function apply($model, RepositoryInterface $repository)
{
foreach(['status', 'visible_individually'] as $code) {
foreach (['status', 'visible_individually'] as $code) {
$attribute = $this->attribute->findOneByField('code', $code);
$alias = 'filter_' . $attribute->code;

View File

@ -47,7 +47,7 @@ class FilterByAttributesCriteria extends AbstractProduct implements CriteriaInte
'variants' => 'variant_filter_'
];
foreach($aliases as $table => $alias) {
foreach ($aliases as $table => $alias) {
$query1 = $query1->orWhere(function($query2) use($model, $table, $alias) {
foreach ($this->attribute->getProductDefaultAttributes(array_keys(request()->input())) as $code => $attribute) {
@ -60,11 +60,11 @@ class FilterByAttributesCriteria extends AbstractProduct implements CriteriaInte
$column = ProductAttributeValue::$attributeTypeFields[$attribute->type];
$temp = explode(',', request()->get($attribute->code));
if($attribute->type != 'price') {
if ($attribute->type != 'price') {
$query2 = $query2->where($aliasTemp . '.attribute_id', $attribute->id);
$query2 = $query2->where(function($query3) use($aliasTemp, $column, $temp) {
foreach($temp as $code => $filterValue) {
foreach ($temp as $code => $filterValue) {
$query3 = $query3->orWhere($aliasTemp . '.' . $column, $filterValue);
}
});

View File

@ -41,8 +41,8 @@ class SortCriteria extends AbstractProduct implements CriteriaInterface
{
$params = request()->input();
if(isset($params['sort'])) {
if($params['sort'] == 'name' || $params['sort'] == 'price') {
if (isset($params['sort'])) {
if ($params['sort'] == 'name' || $params['sort'] == 'price') {
$attribute = $this->attribute->findOneByField('code', $params['sort']);
$alias = 'sort_' . $params['sort'];

Some files were not shown because too many files have changed in this diff Show More