2018-07-26 10:42
浏览 1.5k


I'm trying to implement a new method in a BoController called "deleteBooking", the method is defined:

public function deleteBooking($id){
    $booking = Reservation::find($id);
    if($booking && $booking->delete()){
        try {
            $email = Mail::to($booking->user_email)->send(new Cancel($booking));
        } catch(\Exception $e){

        return redirect('admin/manager/home')->with('message','Réservation annulée!');
    return redirect('admin/manager/home')->with('message','Réservation non annulée!');

But laravel at the endpoint says:

(1/1) BadMethodCallException
Method [deleteBooking] does not exist.

Other methods from the same class are linked to endpoints too, and work well.

Do you have any ideas please? Thank you.

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • donglengli0644 2018-07-26 15:59

    I got it fixed, I've found another file called BoController, in another folder somehow and it was conflicting with the App\Http\Controllers one.

    Thank you.

    解决 无用
    打赏 举报
  • douying4909 2018-07-26 10:50

    It's most likely that you have declared that function for some other request type other than the one you're trying to make. For example you put Route::post('some-method', 'BoController@deleteBooking'); but you need to put either Route::get(...) or Route::put(...) or Route::delete(...).

    If it isn't that problem, then you probably misspelled it.

    解决 无用
    打赏 举报

相关推荐 更多相似问题