#495 fixed multi lang error for category ,advs and customfields

This commit is contained in:
vedatakd 2019-10-22 12:57:09 +03:00
parent 63a2e3c9c0
commit 72d47dbf7f
2 changed files with 13 additions and 12 deletions

View File

@ -6,7 +6,7 @@ use Anomaly\Streams\Platform\Application\Application;
use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
use Anomaly\Streams\Platform\Model\Advs\AdvsAdvsEntryModel;
use Anomaly\Streams\Platform\Model\Cats\CatsCategoryEntryModel;
use Anomaly\Streams\Platform\Model\Users\UsersUsersEntryModel;
use Anomaly\UsersModule\User\UserModel;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Http\Request;
use Visiosoft\AdvsModule\Adv\Table\Filter\CategoryFilterQuery;
@ -72,8 +72,7 @@ class AdvsController extends AdminController
]
]);
if($this->model->is_enabled('recommendedads'))
{
if ($this->model->is_enabled('recommendedads')) {
$table->addButton('add_recommended', [
'type' => 'default',
'icon' => 'fa fa-gg',
@ -96,14 +95,16 @@ class AdvsController extends AdminController
'class' => 'advs-country',
],
'created_by' => [
'value' => function (EntryInterface $entry) {
$user = UsersUsersEntryModel::query()->where('users_users.id', $entry->created_by_id)->first();
'value' => function (EntryInterface $entry, UserModel $userModel) {
$user = $userModel->find($entry->created_by_id);
if (!is_null($user))
return $user->first_name . " " . $user->last_name;
}
],
'category' => [
'value' => function (EntryInterface $entry) {
$category = CategoryModel::query()->where('cats_category.id', $entry->cat1)->first();
'value' => function (EntryInterface $entry, CategoryModel $categoryModel) {
$category = $categoryModel->getCat($entry->cat1);
if (!is_null($category))
return $category->name;
}
],

View File

@ -96,7 +96,8 @@ class CategoryModel extends CatsCategoryEntryModel implements CategoryInterface
$join->on('cats_category.id', '=', 'cats_category_translations.entry_id');
$join->where('cats_category_translations.locale', '=', Request()->session()->get('_locale'));
});
$cats = $cats->orderBy('cats_category_translations.id', 'DESC')
$cats = $cats->select('cats_category.*','cats_category_translations.name as name');
$cats = $cats->orderBy('id', 'DESC')
->get();
foreach ($cats as $cat) {
$link = '';
@ -112,7 +113,6 @@ class CategoryModel extends CatsCategoryEntryModel implements CategoryInterface
$data[] = array(
'id' => $cat->id,
'name' => $cat->name,
'locale' => $cat->locale,
'parents' => $link
);
}