Laravel找不到控制器方法(不存在) [英] Laravel cannot find a Controller Method (does not exist)

查看:874
本文介绍了Laravel找不到控制器方法(不存在)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在BoController中实现一个名为"deleteeBooking"的新方法,该方法已定义:

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!');
}

但是端点上的laravel说:

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.

推荐答案

我已修复它,我在另一个文件夹中找到了另一个名为BoController的文件,它与App \ Http \ Controllers冲突.

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.

谢谢.

这篇关于Laravel找不到控制器方法(不存在)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆