S
S
supercoder6662021-04-11 17:04:29
Laravel
supercoder666, 2021-04-11 17:04:29

Why is paginate() not working in laravel?

Paginate doesn't work, throws error Trying to get property 'username' of non-object

Code in controller:

public function users() {
$users = DB::connection('mysql_usersData')->table('users')->paginate(4);
$usersList = collect($users);
return view('admin.users',['usersList' => $usersList->sortBy('username')]);
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question