refactor: fixes and updates

- still need to add lang and test
This commit is contained in:
HDVinnie
2022-09-07 10:12:13 -04:00
parent 608ae53385
commit fbf16412e3
8 changed files with 175 additions and 171 deletions
+12 -3
View File
@@ -13,6 +13,7 @@
namespace App\Http\Controllers;
use App\Models\BlacklistClient;
use App\Models\Group;
use App\Models\Internal;
use App\Models\Page;
@@ -48,7 +49,12 @@ class PageController extends Controller
*/
public function staff(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
{
$staff = Group::with('users:id,username,group_id,title')->where('is_modo', '=', 1)->orWhere('is_admin', '=', 1)->get()->sortByDesc('position');
$staff = Group::query()
->with('users:id,username,group_id,title')
->where('is_modo', '=', 1)
->orWhere('is_admin', '=', 1)
->get()
->sortByDesc('position');
return \view('page.staff', ['staff' => $staff]);
}
@@ -58,7 +64,10 @@ class PageController extends Controller
*/
public function internal(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
{
$internals = Internal::with('users')->get()->sortBy('name');
$internals = Internal::query()
->with('users')
->get()
->sortBy('name');
return \view('page.internal', ['internals' => $internals]);
}
@@ -68,7 +77,7 @@ class PageController extends Controller
*/
public function clientblacklist(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
{
$clients = DB::table('blacklist_clients')->get();
$clients = BlacklistClient::all();
return \view('page.blacklist.client', ['clients' => $clients]);
}