1. I have just come into contact with TP5, and I am confused about the correlation model in the manual. I am here to ask for help~~ I hope you can get some answers. First post the error screenshot
#2. The model code is as follows
namespace app\index\model;
use think\Model;
class User extends Model{
public function group(){
//用戶表 belongsToMany 用戶組表(關(guān)聯(lián)模型,中間表,關(guān)聯(lián)id1,關(guān)聯(lián)id2)
return $this->belongsToMany('Group','auth_group_access','uid','group_id');
}
}
3. The controller code is as follows
namespace app\index\controller;
use think\Controller;
use think\Db;
use think\Request;
use app\index\model\User as Usermodel;
class User extends Controller{
//用戶列表
public function index(){
$user = new Usermodel();
$data = $user->group;
p($data);die;
$this->assign('v',$data);
return $this -> fetch();
}
}
認(rèn)證0級(jí)講師
The id attribute does not exist. See how $notFound is obtained. Is there any missing parameters?