mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-09 06:46:08 -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\SettingsModule\Setting\Contract\SettingRepositoryInterface;
|
||||||
use Anomaly\Streams\Platform\Addon\AddonCollection;
|
use Anomaly\Streams\Platform\Addon\AddonCollection;
|
||||||
use Anomaly\Streams\Platform\Entry\EntryCriteria;
|
use Anomaly\Streams\Platform\Entry\EntryCriteria;
|
||||||
|
use Anomaly\Streams\Platform\Image\Image;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Visiosoft\RecentlyviewedadsModule\Recently\RecentlyModel;
|
use Visiosoft\RecentlyviewedadsModule\Recently\RecentlyModel;
|
||||||
use Visiosoft\SubscriptionsModule\User\UserModel;
|
use Visiosoft\SubscriptionsModule\User\UserModel;
|
||||||
@ -10,9 +11,12 @@ use Visiosoft\SubscriptionsModule\User\UserModel;
|
|||||||
class AdvCriteria extends EntryCriteria
|
class AdvCriteria extends EntryCriteria
|
||||||
{
|
{
|
||||||
|
|
||||||
public function __construct(SettingRepositoryInterface $repository)
|
private $image;
|
||||||
|
|
||||||
|
public function __construct(SettingRepositoryInterface $repository, Image $image)
|
||||||
{
|
{
|
||||||
$this->settings = $repository;
|
$this->settings = $repository;
|
||||||
|
$this->image = $image;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function popularAdvs()
|
public function popularAdvs()
|
||||||
@ -97,6 +101,21 @@ class AdvCriteria extends EntryCriteria
|
|||||||
return $advModel->is_enabled($slug);
|
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()
|
public function recentlyViewedAds()
|
||||||
{
|
{
|
||||||
$advModel = new AdvModel();
|
$advModel = new AdvModel();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user