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'));
}
}
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 show($id)
{
$us = User::findOrFail($id);
return view('auth.pre',compact('us'));
}
<a href="{{ URL('profile/show/'.$user->id) }}">{{$user->name}}</a>