mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-24 22:11:01 -06:00
Merge pull request #887 from openclassify/dia
#2917 emlak24 program dahilinde yapılacaklar
This commit is contained in:
commit
5ee354e6a5
@ -46,4 +46,9 @@ return [
|
|||||||
'write',
|
'write',
|
||||||
'delete',
|
'delete',
|
||||||
],
|
],
|
||||||
|
'status' => [
|
||||||
|
'read',
|
||||||
|
'write',
|
||||||
|
'delete',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -43,4 +43,5 @@ return [
|
|||||||
'fast_create' => 'Fast create',
|
'fast_create' => 'Fast create',
|
||||||
'publish' => 'Publish',
|
'publish' => 'Publish',
|
||||||
'import' => 'Import',
|
'import' => 'Import',
|
||||||
|
'new_status' => 'New Status',
|
||||||
];
|
];
|
||||||
|
|||||||
@ -97,4 +97,12 @@ return [
|
|||||||
'delete' => 'Can delete option configuration?',
|
'delete' => 'Can delete option configuration?',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'status' => [
|
||||||
|
'name' => 'Status',
|
||||||
|
'option' => [
|
||||||
|
'read' => 'Can read status?',
|
||||||
|
'write' => 'Can create/edit status?',
|
||||||
|
'delete' => 'Can delete status?',
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -56,4 +56,7 @@ return [
|
|||||||
'title' => 'Configuration',
|
'title' => 'Configuration',
|
||||||
],
|
],
|
||||||
'translations' => 'Translations',
|
'translations' => 'Translations',
|
||||||
|
'status' => [
|
||||||
|
'title' => 'Status',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -31,4 +31,7 @@ return [
|
|||||||
'option_configuration' => [
|
'option_configuration' => [
|
||||||
'name' => 'Configuration',
|
'name' => 'Configuration',
|
||||||
],
|
],
|
||||||
|
'status' => [
|
||||||
|
'name' => 'Status',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -1,8 +1,29 @@
|
|||||||
<?php namespace Visiosoft\AdvsModule\Adv;
|
<?php namespace Visiosoft\AdvsModule\Adv;
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Entry\EntryCollection;
|
use Anomaly\Streams\Platform\Entry\EntryCollection;
|
||||||
|
use Illuminate\Container\Container;
|
||||||
|
use Illuminate\Pagination\LengthAwarePaginator;
|
||||||
|
use Illuminate\Pagination\Paginator;
|
||||||
|
|
||||||
class AdvCollection extends EntryCollection
|
class AdvCollection extends EntryCollection
|
||||||
{
|
{
|
||||||
|
public function paginate($pageSize = null)
|
||||||
|
{
|
||||||
|
$pageSize = $pageSize ?: setting_value('streams::per_page');
|
||||||
|
$page = Paginator::resolveCurrentPage('page');
|
||||||
|
|
||||||
|
$total = $this->count();
|
||||||
|
|
||||||
|
return self::paginator($this->forPage($page, $pageSize), $total, $pageSize, $page, [
|
||||||
|
'path' => Paginator::resolveCurrentPath(),
|
||||||
|
'pageName' => 'page',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function paginator($items, $total, $perPage, $currentPage, $options)
|
||||||
|
{
|
||||||
|
return Container::getInstance()->makeWith(LengthAwarePaginator::class, compact(
|
||||||
|
'items', 'total', 'perPage', 'currentPage', 'options'
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@ use Anomaly\Streams\Platform\Entry\EntryRepository;
|
|||||||
use Visiosoft\CatsModule\Category\CategoryModel;
|
use Visiosoft\CatsModule\Category\CategoryModel;
|
||||||
use Visiosoft\LocationModule\City\CityModel;
|
use Visiosoft\LocationModule\City\CityModel;
|
||||||
use Visiosoft\LocationModule\Country\CountryModel;
|
use Visiosoft\LocationModule\Country\CountryModel;
|
||||||
|
use Visiosoft\LocationModule\District\DistrictModel;
|
||||||
|
|
||||||
class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||||
{
|
{
|
||||||
@ -215,12 +216,16 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
{
|
{
|
||||||
$country = CountryModel::query()->where('location_countries.id', $adv->country_id)->first();
|
$country = CountryModel::query()->where('location_countries.id', $adv->country_id)->first();
|
||||||
$city = CityModel::query()->where('location_cities.id', $adv->city)->first();
|
$city = CityModel::query()->where('location_cities.id', $adv->city)->first();
|
||||||
|
$district = DistrictModel::query()->where('location_districts.id', $adv->district)->first();
|
||||||
if ($country != null) {
|
if ($country != null) {
|
||||||
$adv->setAttribute('country_name', $country->name);
|
$adv->setAttribute('country_name', $country->name);
|
||||||
}
|
}
|
||||||
if ($city != null) {
|
if ($city != null) {
|
||||||
$adv->setAttribute('city_name', $city->name);
|
$adv->setAttribute('city_name', $city->name);
|
||||||
}
|
}
|
||||||
|
if ($district != null) {
|
||||||
|
$adv->setAttribute('district_name', $district->name);
|
||||||
|
}
|
||||||
return $adv;
|
return $adv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,14 +465,22 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
return $advs->update(['finish_at' => $newDate]);
|
return $advs->update(['finish_at' => $newDate]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getByUsersIDs($usersIDs)
|
public function getByUsersIDs($usersIDs, $status = 'approved', $withDraft = false)
|
||||||
{
|
{
|
||||||
return $this
|
$ads = $this
|
||||||
->newQuery()
|
->newQuery()
|
||||||
->whereIn('advs_advs.created_by_id', $usersIDs)
|
->whereIn('advs_advs.created_by_id', $usersIDs)
|
||||||
->where('advs_advs.slug', '!=', "")
|
|
||||||
->where('advs_advs.status', 'approved')
|
|
||||||
->where('advs_advs.finish_at', '>', date('Y-m-d H:i:s'));
|
->where('advs_advs.finish_at', '>', date('Y-m-d H:i:s'));
|
||||||
|
|
||||||
|
if ($status) {
|
||||||
|
$ads = $ads->where('advs_advs.status', 'approved');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$withDraft) {
|
||||||
|
$ads = $ads->where('advs_advs.slug', '!=', "");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ads;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPopular()
|
public function getPopular()
|
||||||
|
|||||||
@ -45,7 +45,7 @@ interface AdvRepositoryInterface extends EntryRepositoryInterface
|
|||||||
|
|
||||||
public function extendAds($allAds, $isAdmin = false);
|
public function extendAds($allAds, $isAdmin = false);
|
||||||
|
|
||||||
public function getByUsersIDs($usersIDs);
|
public function getByUsersIDs($usersIDs, $status = 'approved', $withDraft = false);
|
||||||
|
|
||||||
public function getPopular();
|
public function getPopular();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user