Deleting an image in the form

Asked

Viewed 27 times

0

I need to delete one image at a time from my bank, I have a table n:m and I’m unable to delete the image.

Follow part of the method to delete the image.

public function deleteImg(Imagem $imagem)
{
    $imagem()->delete();
    \Session::flash('mensagem_sucesso_produtos','Imagem deletada!');
    return back();
}
  • What happens? How are you sending variables to delete? No context.

  • My route is like this: Route::delete('produtos/deletar/{produto}/{imagem}','ProdutosController@deleteImg'); and the action of the button is: <a href="produtos/deletar/{{$produto->id}}/{{$imagem->id}}" class="btn btn-sm btn-danger">&#xA; Remover&#xA; </a>

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.