So, i have 2 tables named 'topics' and 'posts'.
Topics is for the main content of the thread and posts for its reply.
So, i want to if the user delete its topic, then its following reply/post should also be deleted.
Here is my delete form:
{!! Form::open(['action' => ['TopicController@destroy', $topic->id], 'method' => 'POST', 'class' => 'pull-right']) !!}
{!! Form::close() !!}
and here is controller:
$topic = Topic::find($id);
$post = Post::where('topic_id', $id)->get();
$topic->delete();
$post->delete();
return redirect('/')->with('Success', 'Post Removed');
But it is giving error:
BadMethodCallException
Method delete does not exist.
What is did wrong here??
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2BGIYP7
via IFTTT
Aucun commentaire:
Enregistrer un commentaire