fixed reordering to ascending

This commit is contained in:
Amanmyrat 2022-12-24 21:17:57 +05:00
parent 8818652db7
commit 45ac642c47
5 changed files with 7 additions and 7 deletions

View File

@ -9,7 +9,7 @@ class ContactController extends ApiController
{
public function index()
{
$contacts = Contact::orderBy('lft', 'desc')->get();
$contacts = Contact::orderBy('lft', 'asc')->get();
return $this->respondWithCollection($contacts, new ContactTransformer($this->locale));
}
}

View File

@ -9,7 +9,7 @@ class DocumentCategoryController extends ApiController
{
public function index()
{
$categories = DocumentCategory::orderBy('lft', 'desc')->get();
$categories = DocumentCategory::orderBy('lft', 'asc')->get();
return $this->respondWithCollection($categories, new CategoryTransformer($this->locale, 'trading'));
}
}

View File

@ -13,12 +13,12 @@ class DocumentController extends ApiController
$page = $request->page ?? null;
$category = $request->category ?? null;
if($page){
$documents = Document::where('page', $page)->orderBy('lft', 'desc');
$documents = Document::where('page', $page)->orderBy('lft', 'asc');
if(count($documents->get()) < 1){
return $this->errorNotFound();
}
}else{
$documents = Document::orderBy('lft', 'desc');
$documents = Document::orderBy('lft', 'asc');
}
if($category){
$documents = $documents->where('document_category_id', $category);

View File

@ -10,7 +10,7 @@ class MultimediaCategoryController extends ApiController
{
public function index()
{
$categories = MultimediaCategory::orderBy('lft', 'desc')->get();
$categories = MultimediaCategory::orderBy('lft', 'asc')->get();
return $this->respondWithCollection($categories, new CategoryTransformer($this->locale, 'media'));
}
}

View File

@ -12,12 +12,12 @@ class TarifController extends ApiController
{
$type = $request->type ?? null;
if($type){
$tarifs = Tarif::where('type', $type)->orderBy('lft', 'desc')->get();
$tarifs = Tarif::where('type', $type)->orderBy('lft', 'asc')->get();
if(count($tarifs) < 1){
return $this->errorNotFound();
}
}else{
$tarifs = Tarif::orderBy('lft', 'desc')->get();
$tarifs = Tarif::orderBy('lft', 'asc')->get();
}
return $this->respondWithCollection($tarifs, new TarifTransformer($this->locale));
}