Merge pull request #952 from openclassify/dia

#3334 Subworkit needs
This commit is contained in:
Fatih Alp 2021-02-18 10:11:27 +03:00 committed by GitHub
commit a230cd42b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 37 additions and 62 deletions

View File

@ -4,6 +4,11 @@ use Anomaly\Streams\Platform\Database\Migration\Migration;
class VisiosoftModuleAdvsCreateAdvsStream extends Migration
{
public function __construct()
{
\Illuminate\Support\Facades\DB::getDoctrineSchemaManager()
->getDatabasePlatform()->registerDoctrineTypeMapping('point', 'string');
}
/**
* The stream definition.

View File

@ -6,13 +6,6 @@ use Visiosoft\AdvsModule\Adv\Table\Views\unfinished;
class AdvTableBuilder extends TableBuilder
{
/**
* The table views.
*
* @var array|string
*/
protected $views = [
'all' => [
'view' => All::class,
@ -31,25 +24,8 @@ class AdvTableBuilder extends TableBuilder
];
/**
* The table columns.
*
* @var array|string
*/
protected $columns = [];
/**
* The table buttons.
*
* @var array|string
*/
protected $buttons = [];
/**
* The table actions.
*
* @var array|string
*/
protected $actions = [
'delete',
'approve' => [
@ -70,11 +46,6 @@ class AdvTableBuilder extends TableBuilder
],
];
/**
* The table options.
*
* @var array
*/
protected $options = [
'order_by' => [
'id' => 'DESC',
@ -82,11 +53,6 @@ class AdvTableBuilder extends TableBuilder
'table_view' => 'visiosoft.module.advs::admin/table/table'
];
/**
* The table assets.
*
* @var array
*/
protected $assets = [
'scripts.js' => [
'visiosoft.module.advs::js/admin/advanced.js',
@ -96,5 +62,4 @@ class AdvTableBuilder extends TableBuilder
'visiosoft.module.advs::css/admin/filter-user.css',
],
];
}

View File

@ -42,7 +42,7 @@ class AdvTableButtons
'create_configration' => [
'text' => trans('visiosoft.module.advs::button.create_configurations'),
'href' => route('visiosoft.module.advs::configrations.create') . "?ad={entry.id}"]
]
]
]
]);
}

View File

@ -553,7 +553,8 @@ class AdvsController extends PublicController
}
}
$metaTitle = $adv->name . " " . end($categories)['name'] . ' ' . setting_value('streams::domain');
$metaCatName = end($categories) ? end($categories)['name'] : '|';
$metaTitle = $adv->name . " " . $metaCatName . ' ' . setting_value('streams::domain');
$metaDesc = strip_tags($adv->advs_desc, '');
if (is_module_installed('visiosoft.module.seo')) {

View File

@ -112,35 +112,39 @@ class CategoryRepository extends EntryRepository implements CategoryRepositoryIn
public function getMainAndSubCats()
{
$dBName = 'default_cats_category';
$dBName = 'cats_category';
$dBNamet = $dBName . '_translations';
$catsDB = DB::table((DB::raw($dBName . ' c1')))
$catsDB = DB::table($dBName . ' as c1')
->select(
DB::raw('c1.id'),
DB::raw('c1.slug'),
DB::raw('c1.parent_category_id'),
DB::raw('c1.icon_id'),
DB::raw('t1.name'),
DB::raw('c2.id as c2_id'),
DB::raw('c2.slug as c2_slug'),
DB::raw('c2.parent_category_id as c2_parent_category_id'),
DB::raw('t2.name as c2_name'),
DB::raw('file.id as file_id')
'c1.id',
'c1.slug',
'c1.parent_category_id',
'c1.icon_id',
't1.name',
'c2.id as c2_id',
'c2.slug as c2_slug',
'c2.parent_category_id as c2_parent_category_id',
't2.name as c2_name',
'file.id as file_id'
)
->leftJoin((DB::raw($dBName . ' c2')), DB::raw('c2.parent_category_id'), '=', DB::raw('c1.id'))
->leftJoin((DB::raw($dBNamet . ' t1')), DB::raw('c1.id'), '=', DB::raw('t1.entry_id'))
->leftJoin((DB::raw($dBNamet . ' t2')), DB::raw('c2.id'), '=', DB::raw('t2.entry_id'))
->leftJoin(DB::raw('default_files_files file'), DB::raw('c1.icon_id'), DB::raw('file.id'))
->where(DB::raw('t1.locale'), Request()->session()->get('_locale', setting_value('streams::default_locale')))
->where(DB::raw('t2.locale'), Request()->session()->get('_locale', setting_value('streams::default_locale')))
->where(DB::raw("c1.deleted_at"), NULL)
->where(DB::raw("c2.deleted_at"), NULL)
->whereNull(DB::raw("c1.parent_category_id"))
->orderBy(DB::raw("c1.sort_order"))
->orderBy(DB::raw("c2.sort_order"))
->leftJoin($dBName . ' as c2', function ($join) {
$join->on('c2.parent_category_id', '=', 'c1.id')
->whereNull('c2.deleted_at');
})
->leftJoin($dBNamet . ' as t1', function ($join) use ($dBNamet) {
$join->on('c1.id', '=', 't1.entry_id')
->where('t1.locale', Request()->session()->get('_locale', setting_value('streams::default_locale')));
})
->leftJoin($dBNamet . ' as t2', function ($join) use ($dBNamet) {
$join->on('c2.id', '=', 't2.entry_id')
->where('t2.locale', Request()->session()->get('_locale', setting_value('streams::default_locale')));
})
->leftJoin('files_files as file', 'c1.icon_id', 'file.id')
->whereNull('c1.deleted_at')
->whereNull('c1.parent_category_id')
->orderBy('c1.sort_order')
->orderBy('c2.sort_order')
->get();
$cats = collect([]);
$cats->subcats = $catsDB;