Laravel 中的更新错误:Class 'App\Http\Controllers\App\Category' 未找到

Update error in Laravel: Class 'App\Http\Controllers\App\Category' not found

我是 laravel 的新手,我正在尝试使用以下代码更新我的 table。但是收到以下错误

Class 'App\Http\Controllers\App\Category' not found

我的密码是

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use App\Category;
class CategoryController extends Controller
{


    public function UpdateCategory()
    {
        $category = App\Category::find(3);

        $category->name = 'Women';

        $category->save();
    }
}

试试这个

$category = Category::find(3);

改变

$category = App\Category::find(3);

$category = Category::find(3);
use App\Category;

you already include your model in controller. So you dont need to include once again

$category = Category::find(3);

simply use this