Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

401
Views
laravel - Delete method not working in laravel 8

Hello I'm still a beginner at laravel, I got a problem on the delete method.

this my controller

public function destroy($id)
    {
        $home = Home::find($id);
        $home -> delete();
        return back();
    }

this my balde

<div class="col-6 sampah">
 <form action="{{ route('home.destroy', $home->id) }}" method="POST">
  @csrf
  @method('DELETE')
    <a href="">
    <i class="bi bi-trash3-fill" style="width: 10px; height:10px;"></i>
    </a>
 </form>
</div>

this my route

Route::resource('home', 'App\Http\Controllers\TodosController')->middleware('auth');

When I press the delete button, why doesn't it work? Where is the problem? pls, help.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

At the first you need to get what you want to delete this is an example for you it would be your controller:

///REPLACE Crud with your MODEL////

   public function destroy(Request $request,$id){
        $data = Crud::findOrFail($id);
        $data->delete();
        return redirect('YOUR_HOME_PAGE')->with('success', 'User is successfully deleted');
}

this is your blade:

<td>
                
                    <form action="{{ route('home.destroy', $row->id) }}" method="post">
                                                
                    @csrf
                    @method('DELETE')
                    <button type="submit"  class="btn btn-xs btn-danger btn-flat show_confirm" data-toggle="tooltip" title='Delete'>Delete</button>
                </form>
            </td>
        </tr>


 
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!