mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-24 22:11:01 -06:00
add new service
This commit is contained in:
parent
82dda696d7
commit
139ff3d7e9
@ -11,8 +11,14 @@ class AdvApiCollection extends AdvRepository
|
|||||||
|
|
||||||
public function getMyAds()
|
public function getMyAds()
|
||||||
{
|
{
|
||||||
return $this->model->userAdv()
|
return $this->currentAds()
|
||||||
->where('advs_advs.finish_at', '>', date('Y-m-d H:i:s'));
|
->where('created_by_id', Auth::id());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMyExpiredAds()
|
||||||
|
{
|
||||||
|
return $this->expiredAds()
|
||||||
|
->where('created_by_id', Auth::id());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createNewAd(array $params)
|
public function createNewAd(array $params)
|
||||||
@ -40,7 +46,7 @@ class AdvApiCollection extends AdvRepository
|
|||||||
|
|
||||||
$this->checkOwner($ad);
|
$this->checkOwner($ad);
|
||||||
|
|
||||||
unset($params['ad_id'],$params['id'], $params['created_at'], $params['updated_at'],
|
unset($params['ad_id'], $params['id'], $params['created_at'], $params['updated_at'],
|
||||||
$params['deleted_at'], $params['created_by_id'], $params['updated_by_id']);
|
$params['deleted_at'], $params['created_by_id'], $params['updated_by_id']);
|
||||||
|
|
||||||
|
|
||||||
@ -49,7 +55,7 @@ class AdvApiCollection extends AdvRepository
|
|||||||
'updated_at' => Carbon::now()
|
'updated_at' => Carbon::now()
|
||||||
];
|
];
|
||||||
|
|
||||||
$ad->update(array_merge($update_params,$params));
|
$ad->update(array_merge($update_params, $params));
|
||||||
|
|
||||||
return $ad;
|
return $ad;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -569,6 +569,13 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
->orderBy('publish_at', 'desc');
|
->orderBy('publish_at', 'desc');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function expiredAds() {
|
||||||
|
return $this->newQuery()
|
||||||
|
->whereDate('finish_at', '<', date("Y-m-d H:i:s"))
|
||||||
|
->where('slug', '!=', '')
|
||||||
|
->orderBy('publish_at', 'desc');
|
||||||
|
}
|
||||||
|
|
||||||
public function findByCFJSON($key, $value)
|
public function findByCFJSON($key, $value)
|
||||||
{
|
{
|
||||||
return $this->currentAds()
|
return $this->currentAds()
|
||||||
|
|||||||
@ -57,6 +57,8 @@ interface AdvRepositoryInterface extends EntryRepositoryInterface
|
|||||||
|
|
||||||
public function currentAds();
|
public function currentAds();
|
||||||
|
|
||||||
|
public function expiredAds();
|
||||||
|
|
||||||
public function findByCFJSON($key, $value);
|
public function findByCFJSON($key, $value);
|
||||||
|
|
||||||
public function uploadImage();
|
public function uploadImage();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user