Answer the question
In order to leave comments, you need to log in
How to remove url part when displaying image Laravel?
now I have it displayed as https://127.0.0.1:8080/admin/uploads/avatar/zM7kU6...
and I need it to be displayed without admin https://127.0.0.1:8080/uploads/avatar/zM7kU6fquF.jpeg
in I have routes like this
Route::group(['prefix'=>'admin', 'namespace'=>'Admin'], function (){
Route::get('/', '[email protected]');
Route::resource('/users', 'UsersController');
});
public function getImage()
{
if($this->avatar == null)
{
return 'uploads/no-image.png';
}
return 'uploads/avatar/' . $this->avatar;
}
Answer the question
In order to leave comments, you need to log in
if($this->avatar == null)
{
return '/uploads/no-image.png';
}
return '/uploads/avatar/' . $this->avatar;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question