请问,在 webman 里的 controller 里如何引入 model

ekil

问题已经解决,需要安装

composer require vlucas/phpdotenv ^5.1.0
composer require illuminate/database ^8.0

controller/Index.php

<?php
namespace app\controller;

use support\Request;

use app\model\User;

class Index
{
    public function index(Request $request)
    {
        return json(User::all());
    }
}

model/User.php

<?php

namespace app\model;

use support\Model;

class User extends Model
{
    protected $table = 'user';
    protected $primaryKey = 'uid';
    public $timestamps = false;
}

提示 Error: Class 'app\model\User' not found

2151 1 0
1个回答

不败少龙

改了是否重启webman

年代过于久远,无法发表回答
🔝