sort posts by ends_at field
This commit is contained in:
parent
2583fc4e06
commit
b8de5337d5
|
|
@ -50,7 +50,7 @@ class ProductsAPIController extends Controller
|
||||||
'currency.translations:locale,model_id,attribute_data'
|
'currency.translations:locale,model_id,attribute_data'
|
||||||
])
|
])
|
||||||
->approvedAndFreshEndDate()
|
->approvedAndFreshEndDate()
|
||||||
->orderBy('updated_at', $sortOrder);
|
->orderBy('ends_at', $sortOrder);
|
||||||
|
|
||||||
if($categoryId) { // fetch offers by the category of the product
|
if($categoryId) { // fetch offers by the category of the product
|
||||||
$category = Category::find($categoryId);
|
$category = Category::find($categoryId);
|
||||||
|
|
@ -64,7 +64,7 @@ class ProductsAPIController extends Controller
|
||||||
'currency.translations:locale,model_id,attribute_data'
|
'currency.translations:locale,model_id,attribute_data'
|
||||||
])
|
])
|
||||||
->approvedAndFreshEndDate()
|
->approvedAndFreshEndDate()
|
||||||
->orderBy('updated_at', $sortOrder);
|
->orderBy('ends_at', $sortOrder);
|
||||||
} else {
|
} else {
|
||||||
$query = null;
|
$query = null;
|
||||||
}
|
}
|
||||||
|
|
@ -87,7 +87,7 @@ class ProductsAPIController extends Controller
|
||||||
'currency.translations:locale,model_id,attribute_data'
|
'currency.translations:locale,model_id,attribute_data'
|
||||||
])
|
])
|
||||||
->approvedAndFreshEndDate()
|
->approvedAndFreshEndDate()
|
||||||
->orderBy('updated_at', $sortOrder);
|
->orderBy('ends_at', $sortOrder);
|
||||||
} else {
|
} else {
|
||||||
$query = null;
|
$query = null;
|
||||||
}
|
}
|
||||||
|
|
@ -101,7 +101,7 @@ class ProductsAPIController extends Controller
|
||||||
'measure.translations:locale,model_id,attribute_data',
|
'measure.translations:locale,model_id,attribute_data',
|
||||||
'currency.translations:locale,model_id,attribute_data'
|
'currency.translations:locale,model_id,attribute_data'
|
||||||
])
|
])
|
||||||
->orderBy('updated_at', $sortOrder);
|
->orderBy('ends_at', $sortOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $query ? $query->paginate($perPage) : null;
|
$data = $query ? $query->paginate($perPage) : null;
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ class Offers extends ComponentBase
|
||||||
$productSlug = $this->property('productSlug');
|
$productSlug = $this->property('productSlug');
|
||||||
$offerId = $this->property('offerId');
|
$offerId = $this->property('offerId');
|
||||||
|
|
||||||
$query = Product::where('status', 'approved')->where('ends_at','>=',\Carbon\Carbon::now())->orderBy('updated_at', $sortOrder);
|
$query = Product::where('status', 'approved')->where('ends_at','>=',\Carbon\Carbon::now())->orderBy('ends_at', $sortOrder);
|
||||||
|
|
||||||
if($cSlug != '') { //fetch offers by the category of the product
|
if($cSlug != '') { //fetch offers by the category of the product
|
||||||
$category = Category::transWhere('slug', $cSlug, Session::get('rainlab.translate.locale'))->first();
|
$category = Category::transWhere('slug', $cSlug, Session::get('rainlab.translate.locale'))->first();
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ layout="birzha_empty"
|
||||||
<!-- Ru -->
|
<!-- Ru -->
|
||||||
<table class="mail" style="border: 1px solid #003197; border-radius: 5px; overflow: hidden; width: 100%; border-spacing: 0;">
|
<table class="mail" style="border: 1px solid #003197; border-radius: 5px; overflow: hidden; width: 100%; border-spacing: 0;">
|
||||||
|
|
||||||
<tr>
|
<tr style="background-image: url({{ asset('themes/birzha/assets/images/footer-bg.png') }})">
|
||||||
<th class="header" style="padding: 0; position: relative;">
|
<th class="header" style="padding: 0; position: relative;">
|
||||||
<div class="header_row" style=" display: flex; align-items: center; padding: 10px 20px;">
|
<div class="header_row" style=" display: flex; align-items: center; padding: 10px 20px;">
|
||||||
<div class="logo" style="width: 44px; height: 44px; margin-right: 20px; position: relative; z-index: 2;">
|
<div class="logo" style="width: 44px; height: 44px; margin-right: 20px; position: relative; z-index: 2;">
|
||||||
|
|
@ -142,7 +142,7 @@ layout="birzha_empty"
|
||||||
<!-- Eng -->
|
<!-- Eng -->
|
||||||
<table class="mail" style="border: 1px solid #003197; border-radius: 5px; overflow: hidden; width: 100%; border-spacing: 0;">
|
<table class="mail" style="border: 1px solid #003197; border-radius: 5px; overflow: hidden; width: 100%; border-spacing: 0;">
|
||||||
|
|
||||||
<tr>
|
<tr style="background-image: url({{ asset('themes/birzha/assets/images/footer-bg.png') }})">
|
||||||
<th class="header" style="padding: 0; position: relative;">
|
<th class="header" style="padding: 0; position: relative;">
|
||||||
<div class="header_row" style=" display: flex; align-items: center; padding: 10px 20px;">
|
<div class="header_row" style=" display: flex; align-items: center; padding: 10px 20px;">
|
||||||
<div class="logo" style="width: 44px; height: 44px; margin-right: 20px; position: relative; z-index: 2;">
|
<div class="logo" style="width: 44px; height: 44px; margin-right: 20px; position: relative; z-index: 2;">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue