首页 > 解决方案 > 找不到我的页面,有人可以帮我吗?

问题描述

这是我在控制器中的功能

public function list()
    {
            $customers = Customer::all();
            foreach ($customers as $customer) {
                $list = [

                    'Customer ID' => $customer->id,
                    'Customer Name' => $customer->full_name,
                ];
                $lists[] = $list;
            }
            $collection = $this->paginate($lists, $perPage = 5, $page = null, $options = []);
            return new mainCollection($collection);
    }

这是我的路线

Route::get('customers/list', 'customerController@list')

当我在 PostMan 中访问http://127.0.0.1:8000/api/customers/list时出现错误 404 Not Found Another Route 运行良好。有人能帮我吗?

标签: laravelapipostman

解决方案


检查php artisan route:list/仔细检查您的路线信息。

此外,请检查您的控制器类名称和命名空间。


推荐阅读