PHP Laravel v5.7.0找不到设备资源控制器的404页面

时间:2018-12-16 03:34:52

标签: php laravel

在显示设备资源控制器的index.blade.php视图时,出现错误404页面未找到。

这是我的文件:

App \ Http \ Controllers \ EquipmentController.php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class EquipmentController extends Controller
{
    /**
    * Display a listing of the resource.
    *
    * @return \Illuminate\Http\Response
    */
    public function index()
   {
        return View::make('equipments.index'); 
   }

   ...
}

routes \ web.php

Route::resource('equipment', 'EquipmentController'); 

resources \ views \ equipments \ index.blade.php

<!DOCTYPE html>
<html>
    <head>
        <title>Equipment</title>
    </head>
    <body>
        <table>
            <thead>
                <th>Chillers</th>
                <th>Setpoint</th>
            </thead>
            <tbody>
                <tr>
                     <td>Chiller 1</td>
                     <td>32&#176C;</td>
                </tr>
                <tr>
                     <td>Chiller 2</td>
                     <td>32&#176C;</td>
                </tr>
                <tr>
                     <td>Chiller 3</td>
                     <td>32&#176C;</td>
                </tr>
            </tbody>
        </table>
     </body>
 </html>

我已经尝试执行“ php artisan cache:clear”无效。请告诉我我在做什么错。谢谢!

1 个答案:

答案 0 :(得分:1)

我发现我做错了什么。使用上述配置,我一直在尝试访问URL'127.0.0.1:8000/equipments'而不是'php artisan route:list'中的路由所指示的'127.0.0.1:8000/equipment'。