Terms & Condition

  • Home
  • / Terms & Condition

In my opnion, you should use url() Laravel method

To call you route with the problem's id you can do:

"{{ url('/problems/' . $problem->id . '/edit') }}" class="btn btn-xs btn-info pull-right">Edit</a>

I used an anchor tag, but it will be rendered like you button tag because I kept the same style class you have defined.

Why you should use url() method ?

The reason is simple, the url method will get the full url to your controller. If you don't use this, href link will get appended with current url.

For example, supose you button is located inside a given page

yourdomain.com/a-given-page/

when someone click in your button, the result will be:

yourdomain.com/a-given-page/problems/{problem-id}/edit

when you would like to get this:

yourdomain.com/problems/{problem-id}/edit

Some considerations about your editProblem method