1

This is my view:

<img src="../public/{{ $axid->img }}">

and this is my route :

Route::get('/ax/{axid}', function($id) {
$axid = show::find($id);
return view('ax', compact('axid'));

Images are uploaded in public/uploads and show is model name. However, I have this error:

NotFoundHttpException

...what is the problem?

4
  • This can just be: <img src="{{ $axid->img }}"> you dont need to add /public Commented Feb 22, 2018 at 10:23
  • 2
    What is show:: a model? Are you calling it correctly? Commented Feb 22, 2018 at 10:24
  • Why on earth are you not doing this in a controller more to the point? Commented Feb 22, 2018 at 10:24
  • ALSO... Where is the view with the a href="" we need to see that Commented Feb 22, 2018 at 10:27

2 Answers 2

1

If we assume that your image resolving code is functioning properly and that you are returning the full url of the image you want to show, then change your view code to:

<img src="{{ asset($axid->img) }}">
Sign up to request clarification or add additional context in comments.

1 Comment

There is no controller...Read his Route::
1

Please see how you should be setting this out:

View before moving to this a href..: <a href="/ax/{{ $variable->id }}">Get ID</a>

Route: Route::get('/ax/{id}', 'AxidController@get');

Controller with me assuming Show is your model name:

public function get($id, Show $show)
    {
        $axid = $show->find($id);

        return view('page', compact('axid'));
    }

On the page of ax/{id}:

<img src="{{ $axid->image }}">

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.