Answer the question
In order to leave comments, you need to log in
How can I display a list of users with links and follow them?
How can I display a list of users with links and follow them?
Controller (part of the code to navigate to the user)
public function show()
{
$user = User::all();
return view('auth.pre', array('us'=>$user));
}
Now displays the page of the user under which I sit.
Answer the question
In order to leave comments, you need to log in
Example for displaying one user :
public function show($id)
{
$user = User::whereId($id)->firstOrFail();
return view('user.show', ['user' => $user]);
}
public function index()
{
$users = User::paginate(10);
return view('user.list', ['users' => $users]);
}
<ul>
@foreach ($users as $user)
<li><a href="route('user.show', ['id' => $user->id])">{{$user->name}}</a></li>
@endforeach
</ul>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question