You also can use it
<img src="{{ \Auth::user()->userdetail->file_name }}" alt="user_auth" class="user-auth-img img-circle"/>
If file_name store only name of picture, you need add prefix with folder name e.g.
src="/files/useravatars/{{ \Auth::user()->userdetail->file_name }}"
If i get you right, you can use Auth::id() or Auth::user()->id for get current logged user id's OR I think you mean how parse route with user id:
//in web.php (routes)
Route::get('/dashboard/user/{user}', 'DasboardController@getuser')->with('user', '[0-9]+');
//RouteServiceProvider.php in boot()
$this->model('user', 'App\Models\User');
Enjoy :)
This is my route. Do i have to include the /{id} in the admin/dashboard route?
Route::group(['middleware' => ['auth','admin'], 'prefix' => 'admin'], function() {
Route::get('dashboard', 'AdminController@index');
});
I get this error
Trying to get property of non-object (View: C:\xampp\htdocs\mypharma\resources\views\admin\partials\header.blade.php) (View: C:\xampp\htdocs\mypharma\resources\views\admin\partials\header.blade.php)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community