Merge pull request #608 from openclassify/dia

#1749 [arabam-theme] Rest of pages (profile)
This commit is contained in:
Ozcan Durak 2020-07-03 18:46:17 +03:00 committed by GitHub
commit 110498d8b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
<?php namespace Visiosoft\AdvsModule; <?php namespace Visiosoft\AdvsModule;
use Anomaly\Streams\Platform\Addon\Plugin\Plugin; use Anomaly\Streams\Platform\Addon\Plugin\Plugin;
use Visiosoft\AdvsModule\Adv\AdvModel;
use Visiosoft\AdvsModule\Adv\Command\appendRequestURL; use Visiosoft\AdvsModule\Adv\Command\appendRequestURL;
use Visiosoft\AdvsModule\Adv\Command\GetAd; use Visiosoft\AdvsModule\Adv\Command\GetAd;
use Visiosoft\AdvsModule\Adv\Command\isActive; use Visiosoft\AdvsModule\Adv\Command\isActive;
@ -59,6 +60,33 @@ class AdvsModulePlugin extends Plugin
return $this->dispatch(new appendRequestURL($request, $url, $new_parameters)); 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();
}
) )
]; ];
} }