backend pagination and sorting from laravel database

This commit is contained in:
Peter Papp
2020-08-21 16:04:21 +02:00
parent 3e6e046dfc
commit 6dd0b4f026
37 changed files with 853 additions and 505 deletions

View File

@@ -60,7 +60,7 @@ class DashboardController extends Controller
public function new_registrations()
{
return new UsersCollection(
User::take(7)->orderByDesc('created_at')->get()
User::sortable(['created_at' => 'desc'])->paginate(10)
);
}
}

View File

@@ -19,7 +19,7 @@ class PagesController extends Controller
public function index()
{
return new PageCollection(
Page::all()
Page::sortable()->paginate(10)
);
}

View File

@@ -153,7 +153,7 @@ class PlanController extends Controller
$subscribers = Subscription::where('stripe_plan', $id)->pluck('user_id');
return new UsersCollection(
User::findMany($subscribers)
User::sortable()->findMany($subscribers)
);
}
}

View File

@@ -102,7 +102,7 @@ class UserController extends Controller
public function users()
{
return new UsersCollection(
User::all()
User::sortable()->paginate('20')
);
}