Merge pull request #1202 from openclassify/vedat

add new service
This commit is contained in:
Fatih Alp 2021-10-19 15:20:05 +03:00 committed by GitHub
commit 1fc5cbbd5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 7 deletions

View File

@ -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;
} }

View File

@ -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()

View File

@ -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();

View File

@ -2,7 +2,7 @@
<li class="categories-list-li category-icon category-{{ main_category.slug }}"> <li class="categories-list-li category-icon category-{{ main_category.slug }}">
{% set categoryIcon = (main_category.icon) ? main_category.icon : img('visiosoft.theme.base::images/default-categories-icon.png').url %} {% set categoryIcon = (main_category.icon) ? main_category.icon : img('visiosoft.theme.base::images/default-categories-icon.png').url %}
<img src="{{ categoryIcon }}" alt="{{ main_category.name }}" class="img-responsive"> <img src="{{ categoryIcon }}?v={{ random() }}" alt="{{ main_category.name }}" class="img-responsive">
<a href="{{ url_route('adv_list_seo', [main_category.slug]) }}" class="main-category"> <a href="{{ url_route('adv_list_seo', [main_category.slug]) }}" class="main-category">
<b>{{ main_category.name }}</b> <b>{{ main_category.name }}</b>
{% if showAdsCount %} {% if showAdsCount %}

View File

@ -16,7 +16,7 @@ class CategoryModel extends CatsCategoryEntryModel implements CategoryInterface
if ($this->icon === null) { if ($this->icon === null) {
return $this->dispatch(new MakeImageInstance('visiosoft.module.advs::images/listing/sample-cat-icon.svg', 'img'))->url(); return $this->dispatch(new MakeImageInstance('visiosoft.module.advs::images/listing/sample-cat-icon.svg', 'img'))->url();
} }
return $this->icon; return $this->icon.'?v='.rand();
} }
public function getCat($id) public function getCat($id)

View File

@ -271,7 +271,9 @@ class CategoryController extends AdminController
$file = $uploader->upload($file, $folder); $file = $uploader->upload($file, $folder);
$category->setCategoryIconUrl($file->make()->url()); $url = route('anomaly.module.files::files.view',['folder' => $folder->slug,'name' => $file->name]);
$category->setCategoryIconUrl($url);
} catch (\Exception $exception) { } catch (\Exception $exception) {
$this->messages->error($exception->getMessage()); $this->messages->error($exception->getMessage());
} }