B
B
BonBon Slick2016-11-05 16:02:19
Laravel
BonBon Slick, 2016-11-05 16:02:19

Back button refresh page Laravel 5.3?

Here is the button code

<a href="{{ URL::previous() }}" class="btn btn-default">BACK</a>

If I visit the page it works correctly, BUT if I put a comment , here is the comment controller:
public function addComment(Request $request,   $product){
    $product = Product::find($product);
    $product->addComment(
      new Comment($request->all())
      );
    return back();
  }

The URL of the button takes the URL that the product has, as a result, when clicked, it redirects to the same page! (works as a page refresh) How to fix this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Perin, 2016-11-05
@BonBonSlick

Everything works out logically

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question