mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-09 14:56:13 -06:00
Merge branch 'dia' of https://github.com/openclassify/openclassify
This commit is contained in:
commit
2a32eec777
@ -62,7 +62,7 @@ class AdvPresenter extends EntryPresenter
|
|||||||
public function isCorporate()
|
public function isCorporate()
|
||||||
{
|
{
|
||||||
$user_id = $this->getObject()->created_by;
|
$user_id = $this->getObject()->created_by;
|
||||||
if ($user_id->register_type != null) {
|
if ($user_id && $user_id->register_type != null) {
|
||||||
return $user_id->register_type;
|
return $user_id->register_type;
|
||||||
} else {
|
} else {
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -436,9 +436,10 @@ class AdvsController extends PublicController
|
|||||||
|
|
||||||
$user = null;
|
$user = null;
|
||||||
if (\request()->user) {
|
if (\request()->user) {
|
||||||
$user = $this->userRepository->find(\request()->user);
|
if ($user = $this->userRepository->find(\request()->user)) {
|
||||||
$showTitle = false;
|
$showTitle = false;
|
||||||
$metaTitle = $user->name() . ' ' . trans('visiosoft.module.advs::field.ads');
|
$metaTitle = $user->name() . ' ' . trans('visiosoft.module.advs::field.ads');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->template->set('showTitle', $showTitle);
|
$this->template->set('showTitle', $showTitle);
|
||||||
|
|||||||
@ -94,7 +94,8 @@ return [
|
|||||||
'options' => [
|
'options' => [
|
||||||
'slug' => 'slug',
|
'slug' => 'slug',
|
||||||
'id' => 'id',
|
'id' => 'id',
|
||||||
'order' => 'order'
|
'order' => 'order',
|
||||||
|
'name' => 'name',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php namespace Visiosoft\LocationModule\City;
|
<?php namespace Visiosoft\LocationModule\City;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Model\Location\LocationCitiesEntryTranslationsModel;
|
||||||
use Visiosoft\LocationModule\City\Contract\CityRepositoryInterface;
|
use Visiosoft\LocationModule\City\Contract\CityRepositoryInterface;
|
||||||
use Anomaly\Streams\Platform\Entry\EntryRepository;
|
use Anomaly\Streams\Platform\Entry\EntryRepository;
|
||||||
|
|
||||||
@ -13,18 +14,38 @@ class CityRepository extends EntryRepository implements CityRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
protected $model;
|
protected $model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var LocationCitiesEntryTranslationsModel
|
||||||
|
*/
|
||||||
|
private $citiesEntryTranslationsModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new CityRepository instance.
|
* Create a new CityRepository instance.
|
||||||
*
|
*
|
||||||
* @param CityModel $model
|
* @param CityModel $model
|
||||||
*/
|
*/
|
||||||
public function __construct(CityModel $model)
|
public function __construct(CityModel $model, LocationCitiesEntryTranslationsModel $citiesEntryTranslationsModel)
|
||||||
{
|
{
|
||||||
$this->model = $model;
|
$this->model = $model;
|
||||||
|
$this->citiesEntryTranslationsModel = $citiesEntryTranslationsModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findById($id)
|
public function findById($id)
|
||||||
{
|
{
|
||||||
return $this->model->orderBy('created_at', 'DESC')->where('location_cities.id', $id)->first();
|
return $this->model->orderBy('created_at', 'DESC')->where('location_cities.id', $id)->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getByEntryIDsAndOrderByTransCol($entryIDs, $orderBy, $direction = 'asc')
|
||||||
|
{
|
||||||
|
return $this->citiesEntryTranslationsModel->newQuery()
|
||||||
|
->select('entry_id as id', 'name')
|
||||||
|
->whereIn('locale', [
|
||||||
|
Request()->session()->get('_locale'),
|
||||||
|
setting_value('streams::default_locale'),
|
||||||
|
'en'
|
||||||
|
])
|
||||||
|
->whereIn('entry_id', $entryIDs)
|
||||||
|
->orderBy($orderBy, $direction)
|
||||||
|
->get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,4 +5,6 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
|
|||||||
interface CityRepositoryInterface extends EntryRepositoryInterface
|
interface CityRepositoryInterface extends EntryRepositoryInterface
|
||||||
{
|
{
|
||||||
public function findById($id);
|
public function findById($id);
|
||||||
|
|
||||||
|
public function getByEntryIDsAndOrderByTransCol($entryIDs, $orderBy, $direction = 'asc');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,4 +7,6 @@ interface CountryRepositoryInterface extends EntryRepositoryInterface
|
|||||||
public function findById($id);
|
public function findById($id);
|
||||||
|
|
||||||
public function viewAll();
|
public function viewAll();
|
||||||
|
|
||||||
|
public function getByEntryIDsAndOrderByTransCol($entryIDs, $orderBy, $direction = 'asc');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php namespace Visiosoft\LocationModule\Country;
|
<?php namespace Visiosoft\LocationModule\Country;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Model\Location\LocationCountriesEntryTranslationsModel;
|
||||||
use Visiosoft\LocationModule\Country\Contract\CountryRepositoryInterface;
|
use Visiosoft\LocationModule\Country\Contract\CountryRepositoryInterface;
|
||||||
use Anomaly\Streams\Platform\Entry\EntryRepository;
|
use Anomaly\Streams\Platform\Entry\EntryRepository;
|
||||||
|
|
||||||
@ -13,14 +14,23 @@ class CountryRepository extends EntryRepository implements CountryRepositoryInte
|
|||||||
*/
|
*/
|
||||||
protected $model;
|
protected $model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var LocationCountriesEntryTranslationsModel
|
||||||
|
*/
|
||||||
|
private $countriesEntryTranslationsModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new CountryRepository instance.
|
* Create a new CountryRepository instance.
|
||||||
*
|
*
|
||||||
* @param CountryModel $model
|
* @param CountryModel $model
|
||||||
*/
|
*/
|
||||||
public function __construct(CountryModel $model)
|
public function __construct(
|
||||||
|
CountryModel $model,
|
||||||
|
LocationCountriesEntryTranslationsModel $countriesEntryTranslationsModel
|
||||||
|
)
|
||||||
{
|
{
|
||||||
$this->model = $model;
|
$this->model = $model;
|
||||||
|
$this->countriesEntryTranslationsModel = $countriesEntryTranslationsModel;
|
||||||
}
|
}
|
||||||
public function findById($id)
|
public function findById($id)
|
||||||
{
|
{
|
||||||
@ -30,4 +40,18 @@ class CountryRepository extends EntryRepository implements CountryRepositoryInte
|
|||||||
public function viewAll(){
|
public function viewAll(){
|
||||||
return $this->model->get();
|
return $this->model->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getByEntryIDsAndOrderByTransCol($entryIDs, $orderBy, $direction = 'asc')
|
||||||
|
{
|
||||||
|
return $this->countriesEntryTranslationsModel->newQuery()
|
||||||
|
->select('entry_id as id', 'name')
|
||||||
|
->whereIn('locale', [
|
||||||
|
Request()->session()->get('_locale'),
|
||||||
|
setting_value('streams::default_locale'),
|
||||||
|
'en'
|
||||||
|
])
|
||||||
|
->whereIn('entry_id', $entryIDs)
|
||||||
|
->orderBy($orderBy, $direction)
|
||||||
|
->get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,5 +4,5 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
|
|||||||
|
|
||||||
interface DistrictRepositoryInterface extends EntryRepositoryInterface
|
interface DistrictRepositoryInterface extends EntryRepositoryInterface
|
||||||
{
|
{
|
||||||
|
public function getByEntryIDsAndOrderByTransCol($entryIDs, $orderBy, $direction = 'asc');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php namespace Visiosoft\LocationModule\District;
|
<?php namespace Visiosoft\LocationModule\District;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Model\Location\LocationDistrictsEntryTranslationsModel;
|
||||||
use Visiosoft\LocationModule\District\Contract\DistrictRepositoryInterface;
|
use Visiosoft\LocationModule\District\Contract\DistrictRepositoryInterface;
|
||||||
use Anomaly\Streams\Platform\Entry\EntryRepository;
|
use Anomaly\Streams\Platform\Entry\EntryRepository;
|
||||||
|
|
||||||
@ -13,13 +14,36 @@ class DistrictRepository extends EntryRepository implements DistrictRepositoryIn
|
|||||||
*/
|
*/
|
||||||
protected $model;
|
protected $model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var LocationDistrictsEntryTranslationsModel
|
||||||
|
*/
|
||||||
|
private $districtsEntryTranslationsModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new DistrictRepository instance.
|
* Create a new DistrictRepository instance.
|
||||||
*
|
*
|
||||||
* @param DistrictModel $model
|
* @param DistrictModel $model
|
||||||
*/
|
*/
|
||||||
public function __construct(DistrictModel $model)
|
public function __construct(
|
||||||
|
DistrictModel $model,
|
||||||
|
LocationDistrictsEntryTranslationsModel $districtsEntryTranslationsModel
|
||||||
|
)
|
||||||
{
|
{
|
||||||
$this->model = $model;
|
$this->model = $model;
|
||||||
|
$this->districtsEntryTranslationsModel = $districtsEntryTranslationsModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getByEntryIDsAndOrderByTransCol($entryIDs, $orderBy, $direction = 'asc')
|
||||||
|
{
|
||||||
|
return $this->districtsEntryTranslationsModel->newQuery()
|
||||||
|
->select('entry_id as id', 'name')
|
||||||
|
->whereIn('locale', [
|
||||||
|
Request()->session()->get('_locale'),
|
||||||
|
setting_value('streams::default_locale'),
|
||||||
|
'en'
|
||||||
|
])
|
||||||
|
->whereIn('entry_id', $entryIDs)
|
||||||
|
->orderBy($orderBy, $direction)
|
||||||
|
->get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,131 +1,95 @@
|
|||||||
<?php namespace Visiosoft\LocationModule\Http\Controller;
|
<?php namespace Visiosoft\LocationModule\Http\Controller;
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Http\Controller\PublicController;
|
use Anomaly\Streams\Platform\Http\Controller\PublicController;
|
||||||
use Visiosoft\LocationModule\City\CityModel;
|
use Visiosoft\LocationModule\City\Contract\CityRepositoryInterface;
|
||||||
use Visiosoft\LocationModule\Country\CountryModel;
|
use Visiosoft\LocationModule\Country\Contract\CountryRepositoryInterface;
|
||||||
use Visiosoft\LocationModule\District\DistrictModel;
|
use Visiosoft\LocationModule\District\Contract\DistrictRepositoryInterface;
|
||||||
use Visiosoft\LocationModule\Neighborhood\NeighborhoodModel;
|
use Visiosoft\LocationModule\Neighborhood\Contract\NeighborhoodRepositoryInterface;
|
||||||
use Visiosoft\LocationModule\Village\VillageModel;
|
use Visiosoft\LocationModule\Village\Contract\VillageRepositoryInterface;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class AjaxController extends PublicController
|
class AjaxController extends PublicController
|
||||||
{
|
{
|
||||||
/**
|
private $cityRepository;
|
||||||
* @var CountryModel
|
private $countryRepository;
|
||||||
*/
|
private $districtRepository;
|
||||||
private $country_model;
|
private $neighborhoodRepository;
|
||||||
/**
|
private $villageRepository;
|
||||||
* @var CityModel
|
|
||||||
*/
|
|
||||||
private $city_model;
|
|
||||||
/**
|
|
||||||
* @var DistrictModel
|
|
||||||
*/
|
|
||||||
private $district_model;
|
|
||||||
/**
|
|
||||||
* @var NeighborhoodModel
|
|
||||||
*/
|
|
||||||
private $neighborhood_model;
|
|
||||||
/**
|
|
||||||
* @var VillageModel
|
|
||||||
*/
|
|
||||||
private $village_model;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AjaxController constructor.
|
|
||||||
* @param CountryModel $countryModel
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
CountryModel $countryModel,
|
CityRepositoryInterface $cityRepository,
|
||||||
CityModel $cityModel,
|
CountryRepositoryInterface $countryRepository,
|
||||||
DistrictModel $districtModel,
|
DistrictRepositoryInterface $districtRepository,
|
||||||
NeighborhoodModel $neighborhoodModel,
|
NeighborhoodRepositoryInterface $neighborhoodRepository,
|
||||||
VillageModel $villageModel)
|
VillageRepositoryInterface $villageRepository
|
||||||
|
)
|
||||||
{
|
{
|
||||||
$this->country_model = $countryModel;
|
|
||||||
$this->city_model = $cityModel;
|
|
||||||
$this->district_model = $districtModel;
|
|
||||||
$this->neighborhood_model = $neighborhoodModel;
|
|
||||||
$this->village_model = $villageModel;
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
$this->cityRepository = $cityRepository;
|
||||||
|
$this->countryRepository = $countryRepository;
|
||||||
|
$this->districtRepository = $districtRepository;
|
||||||
|
$this->neighborhoodRepository = $neighborhoodRepository;
|
||||||
|
$this->villageRepository = $villageRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getCountries()
|
public function getCountries()
|
||||||
{
|
{
|
||||||
if ($this->request->id)
|
if ($this->request->id)
|
||||||
return $this->country_model->find($this->request->id);
|
return $this->countryRepository->getModel()->find($this->request->id);
|
||||||
else {
|
else {
|
||||||
$query = $this->country_model;
|
$query = $this->countryRepository->getModel();
|
||||||
return $this->queryOrder($query);
|
return $this->queryOrder($query, $this->countryRepository);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getCities()
|
public function getCities()
|
||||||
{
|
{
|
||||||
if ($this->request->id) {
|
if ($this->request->id) {
|
||||||
$id = explode(',', $this->request->id);
|
$id = explode(',', $this->request->id);
|
||||||
$query = $this->city_model->whereIn('parent_country_id', $id);
|
$query = $this->cityRepository->getModel()->whereIn('parent_country_id', $id);
|
||||||
|
|
||||||
return $this->queryOrder($query);
|
return $this->queryOrder($query, $this->cityRepository);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getDistricts()
|
public function getDistricts()
|
||||||
{
|
{
|
||||||
if ($this->request->id) {
|
if ($this->request->id) {
|
||||||
$id = explode(',', $this->request->id);
|
$id = explode(',', $this->request->id);
|
||||||
|
|
||||||
$query = $this->district_model->whereIn('parent_city_id', $id);
|
$query = $this->districtRepository->getModel()->whereIn('parent_city_id', $id);
|
||||||
|
|
||||||
return $this->queryOrder($query);
|
return $this->queryOrder($query, $this->districtRepository);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getNeighborhoods()
|
public function getNeighborhoods()
|
||||||
{
|
{
|
||||||
if ($this->request->id) {
|
if ($this->request->id) {
|
||||||
$id = explode(',', $this->request->id);
|
$id = explode(',', $this->request->id);
|
||||||
|
|
||||||
$query = $this->neighborhood_model->whereIn('parent_district_id', $id);
|
$query = $this->neighborhoodRepository->getModel()->whereIn('parent_district_id', $id);
|
||||||
|
|
||||||
return $this->queryOrder($query);
|
return $this->queryOrder($query, $this->neighborhoodRepository);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getVillage()
|
public function getVillage()
|
||||||
{
|
{
|
||||||
if ($this->request->id) {
|
if ($this->request->id) {
|
||||||
$id = explode(',', $this->request->id);
|
$id = explode(',', $this->request->id);
|
||||||
|
|
||||||
$query = $this->village_model->whereIn('parent_neighborhood_id', $id);
|
$query = $this->villageRepository->getModel()->whereIn('parent_neighborhood_id', $id);
|
||||||
|
|
||||||
return $this->queryOrder($query);
|
return $this->queryOrder($query, $this->villageRepository);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getCity()
|
public function getCity()
|
||||||
{
|
{
|
||||||
if ($this->request->name) {
|
if ($this->request->name) {
|
||||||
$slug = Str::slug($this->request->name, '_');
|
$slug = Str::slug($this->request->name, '_');
|
||||||
if ($city = $this->city_model->newQuery()->where('slug', 'LIKE', $slug . '%')->first()) {
|
if ($city = $this->cityRepository->getModel()->newQuery()->where('slug', 'LIKE', $slug . '%')->first()) {
|
||||||
return ['success' => true, 'city' => $city];
|
return ['success' => true, 'city' => $city];
|
||||||
} else {
|
} else {
|
||||||
return ['success' => false];
|
return ['success' => false];
|
||||||
@ -133,11 +97,19 @@ class AjaxController extends PublicController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function queryOrder($query)
|
public function queryOrder($query, $repository)
|
||||||
{
|
{
|
||||||
$sorting_type = setting_value('visiosoft.module.location::sorting_type');
|
$sorting_type = setting_value('visiosoft.module.location::sorting_type');
|
||||||
$sorting_column = setting_value('visiosoft.module.location::sorting_column');
|
$sorting_column = setting_value('visiosoft.module.location::sorting_column');
|
||||||
|
|
||||||
|
if ($repository->getModel()->isTranslatedAttribute($sorting_column)) {
|
||||||
|
return $repository->getByEntryIDsAndOrderByTransCol(
|
||||||
|
$query->pluck('id')->all(),
|
||||||
|
$sorting_column,
|
||||||
|
$sorting_type
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return $query->orderBy($sorting_column, $sorting_type)->get();
|
return $query->orderBy($sorting_column, $sorting_type)->get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4,5 +4,5 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
|
|||||||
|
|
||||||
interface NeighborhoodRepositoryInterface extends EntryRepositoryInterface
|
interface NeighborhoodRepositoryInterface extends EntryRepositoryInterface
|
||||||
{
|
{
|
||||||
|
public function getByEntryIDsAndOrderByTransCol($entryIDs, $orderBy, $direction = 'asc');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php namespace Visiosoft\LocationModule\Neighborhood;
|
<?php namespace Visiosoft\LocationModule\Neighborhood;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Model\Location\LocationNeighborhoodsEntryTranslationsModel;
|
||||||
use Visiosoft\LocationModule\Neighborhood\Contract\NeighborhoodRepositoryInterface;
|
use Visiosoft\LocationModule\Neighborhood\Contract\NeighborhoodRepositoryInterface;
|
||||||
use Anomaly\Streams\Platform\Entry\EntryRepository;
|
use Anomaly\Streams\Platform\Entry\EntryRepository;
|
||||||
|
|
||||||
@ -13,13 +14,36 @@ class NeighborhoodRepository extends EntryRepository implements NeighborhoodRepo
|
|||||||
*/
|
*/
|
||||||
protected $model;
|
protected $model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var LocationNeighborhoodsEntryTranslationsModel
|
||||||
|
*/
|
||||||
|
private $neighborhoodsEntryTranslationsModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new NeighborhoodRepository instance.
|
* Create a new NeighborhoodRepository instance.
|
||||||
*
|
*
|
||||||
* @param NeighborhoodModel $model
|
* @param NeighborhoodModel $model
|
||||||
*/
|
*/
|
||||||
public function __construct(NeighborhoodModel $model)
|
public function __construct(
|
||||||
|
NeighborhoodModel $model,
|
||||||
|
LocationNeighborhoodsEntryTranslationsModel $neighborhoodsEntryTranslationsModel
|
||||||
|
)
|
||||||
{
|
{
|
||||||
$this->model = $model;
|
$this->model = $model;
|
||||||
|
$this->neighborhoodsEntryTranslationsModel = $neighborhoodsEntryTranslationsModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getByEntryIDsAndOrderByTransCol($entryIDs, $orderBy, $direction = 'asc')
|
||||||
|
{
|
||||||
|
return $this->neighborhoodsEntryTranslationsModel->newQuery()
|
||||||
|
->select('entry_id as id', 'name')
|
||||||
|
->whereIn('locale', [
|
||||||
|
Request()->session()->get('_locale'),
|
||||||
|
setting_value('streams::default_locale'),
|
||||||
|
'en'
|
||||||
|
])
|
||||||
|
->whereIn('entry_id', $entryIDs)
|
||||||
|
->orderBy($orderBy, $direction)
|
||||||
|
->get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,5 +4,5 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
|
|||||||
|
|
||||||
interface VillageRepositoryInterface extends EntryRepositoryInterface
|
interface VillageRepositoryInterface extends EntryRepositoryInterface
|
||||||
{
|
{
|
||||||
|
public function getByEntryIDsAndOrderByTransCol($entryIDs, $orderBy, $direction = 'asc');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php namespace Visiosoft\LocationModule\Village;
|
<?php namespace Visiosoft\LocationModule\Village;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Model\Location\LocationVillageEntryTranslationsModel;
|
||||||
use Visiosoft\LocationModule\Village\Contract\VillageRepositoryInterface;
|
use Visiosoft\LocationModule\Village\Contract\VillageRepositoryInterface;
|
||||||
use Anomaly\Streams\Platform\Entry\EntryRepository;
|
use Anomaly\Streams\Platform\Entry\EntryRepository;
|
||||||
|
|
||||||
@ -13,13 +14,36 @@ class VillageRepository extends EntryRepository implements VillageRepositoryInte
|
|||||||
*/
|
*/
|
||||||
protected $model;
|
protected $model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var LocationVillageEntryTranslationsModel
|
||||||
|
*/
|
||||||
|
private $villageEntryTranslationsModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new VillageRepository instance.
|
* Create a new VillageRepository instance.
|
||||||
*
|
*
|
||||||
* @param VillageModel $model
|
* @param VillageModel $model
|
||||||
*/
|
*/
|
||||||
public function __construct(VillageModel $model)
|
public function __construct(
|
||||||
|
VillageModel $model,
|
||||||
|
LocationVillageEntryTranslationsModel $villageEntryTranslationsModel
|
||||||
|
)
|
||||||
{
|
{
|
||||||
$this->model = $model;
|
$this->model = $model;
|
||||||
|
$this->villageEntryTranslationsModel = $villageEntryTranslationsModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getByEntryIDsAndOrderByTransCol($entryIDs, $orderBy, $direction = 'asc')
|
||||||
|
{
|
||||||
|
return $this->villageEntryTranslationsModel->newQuery()
|
||||||
|
->select('entry_id as id', 'name')
|
||||||
|
->whereIn('locale', [
|
||||||
|
Request()->session()->get('_locale'),
|
||||||
|
setting_value('streams::default_locale'),
|
||||||
|
'en'
|
||||||
|
])
|
||||||
|
->whereIn('entry_id', $entryIDs)
|
||||||
|
->orderBy($orderBy, $direction)
|
||||||
|
->get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user