<a href="{{ URL('profile/show/'.$user->id) }}">{{$user->name}}</a>
public function show($id)
{
$us = User::findOrFail($id);
return view('auth.pre',compact('us'));
}
User {#234 ▼
#table: "users"
#fillable: array:4 [▶]
#hidden: array:1 [▶]
#persistableKey: "user_id"
#persistableRelationship: "persistences"
#loginNames: array:1 [▶]
#connection: null
#primaryKey: "id"
#keyType: "int"
#perPage: 15
+incrementing: true
+timestamps: true
#attributes: array:10 [▶]
#original: array:10 [▶]
#relations: []
#visible: []
#appends: []
#guarded: array:1 [▶]
#dates: []
#dateFormat: null
#casts: []
#touches: []
#observables: []
#with: []
+exists: true
+wasRecentlyCreated: false
#permissionsInstance: null
}
public function index()
{
if (Sentinel::inRole('manager')) {
if (Sentinel::check()) {
$companys = Company::where('user_id', Sentinel::getUser()->id)->get();
$dev_id = Device::where('user_id', Sentinel::getUser()->id)->get();
} else {
$companys = Company::get();
$dev_id = Device::get();
}
return view('profile.index', compact('us', 'companys', 'dev_id'));
}
}
if ( 'manager' == Auth::user()->role ) {
$user = User::where('creater', 'manager')->get();
} elseif ( 'admin' == Auth::user()->role) {
$user = User::where('creater', 'admin')->get();
}
if(Sentinel::inRole('manager')){
$role = Sentinel::findRoleById(3);
$us = $role->users()->with('roles')->get();
$companys = Company::get();
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>
@foreach ($parents as $parent)
{{$parent->user->name}}
@endforeach