mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
Merge pull request #251 from openclassify/vedat
remove is_active for Response
This commit is contained in:
commit
45749c39d9
@ -47,16 +47,16 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
||||
return $isActive->enabled;
|
||||
}
|
||||
|
||||
public function is_active()
|
||||
public function is_active($id)
|
||||
{
|
||||
$isActive = $this->query()
|
||||
->where('advs_advs.id', $this->id)
|
||||
->where('advs_advs.id', $id)
|
||||
->where('advs_advs.slug', '!=', "")
|
||||
->first();
|
||||
if ($isActive->status != 'approved') {
|
||||
return 0;
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function getAdv($id = null, $nullable_ad = false)
|
||||
@ -273,11 +273,11 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
||||
$adv = $this->getAdv($id);
|
||||
$stock = $adv->stock;
|
||||
if ($stock == NULL or $stock == 0) {
|
||||
return "false";
|
||||
return 0;
|
||||
} elseif ($stock < $quantity) {
|
||||
return "false";//Adet yetmiyorsa
|
||||
return 0;//Adet yetmiyorsa
|
||||
} else {
|
||||
return "true";
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@ -346,7 +346,7 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
||||
if (!is_null($adv)) {
|
||||
return $this->where('advs_advs.slug', '!=', "")
|
||||
->where('advs_advs.status', 'approved')
|
||||
->where('advs_advs.id','!=', $id)
|
||||
->where('advs_advs.id', '!=', $id)
|
||||
->where('advs_advs.finish_at', '>', date('Y-m-d H:i:s'))
|
||||
->where('advs_advs.cat1', $adv->cat1)->get();
|
||||
}
|
||||
|
||||
@ -1,37 +0,0 @@
|
||||
<?php namespace Visiosoft\AdvsModule\Adv;
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: emek
|
||||
* Date: 13.12.2018
|
||||
* Time: 17:54
|
||||
*/
|
||||
|
||||
use Visiosoft\AdvsModule\Adv\Contract\AdvInterface;
|
||||
use Illuminate\Routing\ResponseFactory;
|
||||
|
||||
class AdvResponse {
|
||||
protected $container;
|
||||
|
||||
function __construct(ResponseFactory $response)
|
||||
{
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
public function make(AdvInterface $adv) {
|
||||
if (!$adv->getResponse()) {
|
||||
|
||||
$response = $this->response->view(
|
||||
'visiosoft.module.advs::ad-detail/detail',
|
||||
[
|
||||
'adv' => $adv,
|
||||
]
|
||||
);
|
||||
|
||||
if (!$adv->is_active()) {
|
||||
$response->setTtl(0);
|
||||
}
|
||||
|
||||
$adv->setResponse($response);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,5 +4,4 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
|
||||
|
||||
interface AdvInterface extends EntryInterface
|
||||
{
|
||||
public function is_active();
|
||||
}
|
||||
|
||||
@ -887,7 +887,7 @@ class AdvsController extends PublicController
|
||||
$status = $advmodel->stockControl($id, $quantity);
|
||||
|
||||
$response = array();
|
||||
if ($status == "true") {
|
||||
if ($status == 1) {
|
||||
$response['newQuantity'] = $advRepository->getQuantity($quantity, $type, $adv);
|
||||
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user