dongtaochan0777 2018-07-26 10:42
浏览 1603
已采纳

Laravel找不到控制器方法(不存在)

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){
            Log::error($e->getMessage());
        }

        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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 python中transformers可以正常下载,但是没有办法使用pipeline
  • ¥50 分布式追踪trace异常问题
  • ¥15 人在外地出差,速帮一点点
  • ¥15 如何使用canvas在图片上进行如下的标注,以下代码不起作用,如何修改
  • ¥15 Windows 系统cmd后提示“加载用户设置时遇到错误”
  • ¥50 vue router 动态路由问题
  • ¥15 关于#.net#的问题:End Function
  • ¥15 无法import pycausal
  • ¥15 weditor无法连接模拟器Local server not started, start with?
  • ¥20 6-3 String类定义