mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
rewrite messages-module
This commit is contained in:
parent
845cbed18b
commit
a37ad27e2d
@ -3,6 +3,7 @@
|
||||
use Anomaly\SettingsModule\Setting\Contract\SettingRepositoryInterface;
|
||||
use Anomaly\Streams\Platform\Addon\AddonCollection;
|
||||
use Anomaly\Streams\Platform\Entry\EntryCriteria;
|
||||
use Anomaly\Streams\Platform\Image\Image;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Visiosoft\RecentlyviewedadsModule\Recently\RecentlyModel;
|
||||
use Visiosoft\SubscriptionsModule\User\UserModel;
|
||||
@ -10,9 +11,12 @@ use Visiosoft\SubscriptionsModule\User\UserModel;
|
||||
class AdvCriteria extends EntryCriteria
|
||||
{
|
||||
|
||||
public function __construct(SettingRepositoryInterface $repository)
|
||||
private $image;
|
||||
|
||||
public function __construct(SettingRepositoryInterface $repository, Image $image)
|
||||
{
|
||||
$this->settings = $repository;
|
||||
$this->image = $image;
|
||||
}
|
||||
|
||||
public function popularAdvs()
|
||||
@ -97,6 +101,21 @@ class AdvCriteria extends EntryCriteria
|
||||
return $advModel->is_enabled($slug);
|
||||
}
|
||||
|
||||
public function getAdvById($id)
|
||||
{
|
||||
$advModel = new AdvModel();
|
||||
$adv = $advModel->newQuery()->find($id);
|
||||
if (!$adv->cover_photo) {
|
||||
$adv->cover_photo = $this->image->make('visiosoft.theme.base::images/no-image.png', 'path')->url();
|
||||
} else if (
|
||||
!empty($adv->cover_photo) &&
|
||||
substr($adv->cover_photo, 0, strlen('/')) !== '/'
|
||||
) {
|
||||
$adv->cover_photo = '/' . $adv->cover_photo;
|
||||
}
|
||||
return $adv;
|
||||
}
|
||||
|
||||
public function recentlyViewedAds()
|
||||
{
|
||||
$advModel = new AdvModel();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user