Merge pull request #1247 from openclassify/vedat

update
This commit is contained in:
Fatih Alp 2021-12-10 16:08:29 +03:00 committed by GitHub
commit e10a0a087a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -146,6 +146,10 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
$query = $query->whereDate('advs_advs.created_at', $param['created_at']);
}
if (!empty($param['start_publish_at']) && !empty($param['finish_publish_at'])) {
$query = $query->whereBetween('advs_advs.publish_at', [Carbon::make($param['start_publish_at'] . " 23:59"), Carbon::make($param['finish_publish_at'] . " 00:00")]);
}
foreach ($param as $para => $value) {
if (substr($para, 0, 3) === "cf_") {
$id = substr($para, 3);
@ -304,7 +308,7 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
{
if (count($adv->files) != 0) {
$fileName = $adv->files[0]->name;
$ext = explode('.',$fileName);
$ext = explode('.', $fileName);
if ($ext[1] != 'svg') {
$fileName = 'tn-' . $fileName;
}
@ -316,10 +320,10 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
// Create thumbnail image
$arrContextOptions=array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
$arrContextOptions = array(
"ssl" => array(
"verify_peer" => false,
"verify_peer_name" => false,
),
);
@ -401,7 +405,8 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
return $this->model->orderBy('created_at', 'DESC')->whereIn('advs_advs.id', $ids)->get();
}
public function hideAdsWithoutOutOfStock($ads) {
public function hideAdsWithoutOutOfStock($ads)
{
return $ads->filter(
function ($entry) {
return (($entry->is_get_adv == true && $entry->stock > 0) || ($entry->is_get_adv == false));
@ -584,14 +589,16 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
->get();
}
public function currentAds() {
public function currentAds()
{
return $this->newQuery()->whereDate('finish_at', '>=', date("Y-m-d H:i:s"))
->where('status', '=', 'approved')
->where('slug', '!=', '')
->orderBy('publish_at', 'desc');
}
public function expiredAds() {
public function expiredAds()
{
return $this->newQuery()
->whereDate('finish_at', '<', date("Y-m-d H:i:s"))
->where('slug', '!=', '')