U
U
usdbuy2019-09-06 10:03:33
Laravel
usdbuy, 2019-09-06 10:03:33

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');
});

here is the method that pulls the picture
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

1 answer(s)
A
Alex Wells, 2019-09-06
@usdbuy

if($this->avatar == null)
    {
        return '/uploads/no-image.png';
    }

    return '/uploads/avatar/' . $this->avatar;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question