mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-09 06:46:08 -06:00
#2480 Sales Reports
This commit is contained in:
parent
a6ca1a6eb1
commit
d9f4a07b07
@ -184,4 +184,36 @@ class CategoryRepository extends EntryRepository implements CategoryRepositoryIn
|
|||||||
$cats->maincats = $catsDB->unique('id');
|
$cats->maincats = $catsDB->unique('id');
|
||||||
return $cats;
|
return $cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function noMetaReport()
|
||||||
|
{
|
||||||
|
$categories = $this->newQuery()
|
||||||
|
->select('name as category', 'cats_category.id')
|
||||||
|
->where(function ($q) {
|
||||||
|
$q->whereNull('seo_keyword')
|
||||||
|
->orWhereNull('seo_description');
|
||||||
|
})
|
||||||
|
->leftJoin('cats_category_translations as cats_trans', function ($join) {
|
||||||
|
$join->on('cats_category.id', '=', 'cats_trans.entry_id');
|
||||||
|
$join->whereIn('locale', [config('app.locale'), setting_value('streams::default_locale'), 'en']);
|
||||||
|
});
|
||||||
|
|
||||||
|
if ($search = request('search.value')) {
|
||||||
|
$categories = $categories->where('name', 'LIKE', "%$search%");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($orderDir = request('order.0.dir')) {
|
||||||
|
$categories = $categories->orderBy('category', $orderDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
$start = request('start');
|
||||||
|
$limit = request('length') ?: 10;
|
||||||
|
$page = $start ? $start / $limit + 1 : 1;
|
||||||
|
|
||||||
|
$categories = $categories->paginate($limit, ['*'], 'page', $page);
|
||||||
|
$categories->recordsTotal = $categories->total();
|
||||||
|
$categories->recordsFiltered = $categories->total();
|
||||||
|
|
||||||
|
return $categories;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,4 +23,6 @@ interface CategoryRepositoryInterface extends EntryRepositoryInterface
|
|||||||
public function getDeletedCategories();
|
public function getDeletedCategories();
|
||||||
|
|
||||||
public function getMainAndSubCats();
|
public function getMainAndSubCats();
|
||||||
|
|
||||||
|
public function noMetaReport();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,12 @@
|
|||||||
|
<?php namespace Visiosoft\CatsModule\Http\Controller\Admin;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Http\Controller\AdminController;
|
||||||
|
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
|
||||||
|
|
||||||
|
class ReportController extends AdminController
|
||||||
|
{
|
||||||
|
public function category(CategoryRepositoryInterface $categoryRepository)
|
||||||
|
{
|
||||||
|
return $categoryRepository->noMetaReport();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user