#1749 [arabam-theme] Rest of pages (profile)

This commit is contained in:
Diatrex 2020-07-03 18:44:23 +03:00
parent 34e2930c77
commit bea817677d

View File

@ -1,6 +1,7 @@
<?php namespace Visiosoft\AdvsModule;
use Anomaly\Streams\Platform\Addon\Plugin\Plugin;
use Visiosoft\AdvsModule\Adv\AdvModel;
use Visiosoft\AdvsModule\Adv\Command\appendRequestURL;
use Visiosoft\AdvsModule\Adv\Command\GetAd;
use Visiosoft\AdvsModule\Adv\Command\isActive;
@ -59,6 +60,33 @@ class AdvsModulePlugin extends Plugin
return $this->dispatch(new appendRequestURL($request, $url, $new_parameters));
}
),
new \Twig_SimpleFunction(
'getUserAllAdvs',
function ($user = null) {
if (!$user) {
$user = auth()->user();
}
$advModel = new AdvModel();
return $advModel->newQuery()
->where('advs_advs.created_by_id', $user->id)
->get();
}
),
new \Twig_SimpleFunction(
'getUserPassiveAdvs',
function ($user = null) {
if (!$user) {
$user = auth()->user();
}
$advModel = new AdvModel();
return $advModel->newQuery()
->where('advs_advs.created_by_id', $user->id)
->where('status', 'passive')
->get();
}
)
];
}