Laravel错误。请求不会退出。为什么?

时间:2017-06-25 20:29:06

标签: laravel

这是控制器页面。错误说

  

请求不存在

我无法找到原因。

<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    public function insert( Request $req) 
    {
            $name=$req->input('task_name');

            $detail=$req->input('task_detail');

            $data=array('task_name'=>$name,'task_detail'=>$detail);

            DB::table('tasks')->insert($data);
            echo "success";
    }
}

1 个答案:

答案 0 :(得分:2)

添加命名空间

use App\Http\Requests\Request;