What should I do if I want to exclude the first row in retrieving the users table?
public function index()
{
$users = User::all();
return view('users.users',['users'=> $users]);
}
What should I do if I want to exclude the first row in retrieving the users table?
public function index()
{
$users = User::all();
return view('users.users',['users'=> $users]);
}
4
Answers
if you want to make static you can do this
Use the Laravel Collection Skip method: documentation
You may use the skip with get() methods to skip a given number of results in the query:
if you want to Skip first record (row 1 "where id = 1");
for that I have used the following logic which is work fine for me.
OR
you can also use offset method.
https://laravel.com/docs/9.x/queries