Dasun
Dasun

Reputation: 612

Laravel Method [where] does not exist error

what did i do is creating this vies for delete function according to its trainee_id.see the screenshot. enter image description here Controller segment is like this

public function admin_destroy($trainee_id)
{
    UserFeedbackController::where('trainee_id','=',$trainee_id)->delete();
    return back(); 
}

Route like this

Route::get('DeleteCertificates/{trainee_id?}', 'UserFeedbackController@admin_destroy')->where('trainee_id', '(.*)');;

linked button in the view as following this

<td> <a class="btn btn-danger" href="DeleteCertificates/{{ $item->trainee_id }}">Delete</a> </td>

here is the error.enter image description here

can anyone suggest me why this getting error.

Upvotes: 0

Views: 1964

Answers (1)

Exprator
Exprator

Reputation: 27523

you are calling the controller name in place of model name, guess the modelname is

UserFeedback

so use this

UserFeedback::where('trainee_id','=',$trainee_id)->delete(); 

Upvotes: 2

Related Questions