mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-07 13:56:05 -06:00
#2417 [packages] users can't see the right to declare (maden)
This commit is contained in:
parent
99a53a863f
commit
beedf72eba
@ -459,4 +459,14 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
|
|
||||||
return $ads;
|
return $ads;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getUserAds($userID = null)
|
||||||
|
{
|
||||||
|
$userID = auth_id_if_null($userID);
|
||||||
|
return $this->newQuery()
|
||||||
|
->where('advs_advs.created_by_id', $userID)
|
||||||
|
->where('status', 'approved')
|
||||||
|
->where('finish_at', '>', date('Y-m-d H:i:s'))
|
||||||
|
->get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,18 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Adv\Command;
|
||||||
|
|
||||||
|
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
||||||
|
|
||||||
|
class GetUserAds
|
||||||
|
{
|
||||||
|
protected $userID;
|
||||||
|
|
||||||
|
public function __construct($userID)
|
||||||
|
{
|
||||||
|
$this->userID = $userID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle(AdvRepositoryInterface $advRepository)
|
||||||
|
{
|
||||||
|
return $advRepository->getUserAds($this->userID);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -46,4 +46,6 @@ interface AdvRepositoryInterface extends EntryRepositoryInterface
|
|||||||
public function getPopular();
|
public function getPopular();
|
||||||
|
|
||||||
public function approveAds($adsIDs);
|
public function approveAds($adsIDs);
|
||||||
|
|
||||||
|
public function getUserAds($userID = null);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,9 +7,9 @@ use Visiosoft\AdvsModule\Adv\Command\appendRequestURL;
|
|||||||
use Visiosoft\AdvsModule\Adv\Command\GetAd;
|
use Visiosoft\AdvsModule\Adv\Command\GetAd;
|
||||||
use Visiosoft\AdvsModule\Adv\Command\getExchange;
|
use Visiosoft\AdvsModule\Adv\Command\getExchange;
|
||||||
use Visiosoft\AdvsModule\Adv\Command\getPopular;
|
use Visiosoft\AdvsModule\Adv\Command\getPopular;
|
||||||
|
use Visiosoft\AdvsModule\Adv\Command\GetUserAds;
|
||||||
use Visiosoft\AdvsModule\Adv\Command\isActive;
|
use Visiosoft\AdvsModule\Adv\Command\isActive;
|
||||||
use Visiosoft\AdvsModule\Adv\Command\LatestAds;
|
use Visiosoft\AdvsModule\Adv\Command\LatestAds;
|
||||||
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
|
||||||
use Visiosoft\AdvsModule\Currency\Currency;
|
use Visiosoft\AdvsModule\Currency\Currency;
|
||||||
use Visiosoft\AdvsModule\Currency\CurrencyFormat;
|
use Visiosoft\AdvsModule\Currency\CurrencyFormat;
|
||||||
|
|
||||||
@ -78,6 +78,12 @@ class AdvsModulePlugin extends Plugin
|
|||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
new \Twig_SimpleFunction(
|
||||||
|
'getUserAds',
|
||||||
|
function ($userID = null) {
|
||||||
|
return $this->dispatch(new GetUserAds($userID));
|
||||||
|
}
|
||||||
|
),
|
||||||
new \Twig_SimpleFunction(
|
new \Twig_SimpleFunction(
|
||||||
'getUserPassiveAdvs',
|
'getUserPassiveAdvs',
|
||||||
function ($user = null) {
|
function ($user = null) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user