Please format your code by putting 3 backticks ``` on a line before and after each code block
Never delete using a GET request. You should post a form. Your route needs to be Route::delete
Hello Guys! I'm just a laravel beginner and I would love your answers to be more clarified. I used delete method to delete a post on laravel framework but it threw an error saying, "Delete method not Supported" so I decided to use GET method and it threw no errors. Not withstanding, the issue is that it redirects without deleting anything not even showing message. This is my block of code executed below:
blade.php file
'''
{{ method_field('GET') }} {{ csrf_field() }} {{ trans('Delete') }} '''controller
''' public function destroy($id) { dd($id); $student = Student::where('id',$id)->delete();
return redirect('/data/{id}')->with('success', 'Data Deleted');
}
'''
route
''' Route::get('/data/{id}', 'App\Http\Controllers\StudentController@destroy'); '''
I joined laracast newly because I've seen that your questions and answers has really been of great help to me so I strongly believe that your responses would give me exactly what I'm looking for. Please I really need you guys help this has kept me on deck for 1 week now I seriously need solutions as fast as possible. Thank you.
Please or to participate in this conversation.