【发布时间】:2020-12-01 17:56:15
【问题描述】:
我正确存储了数据,但是当我尝试在编辑功能中获取数据时,它显示了这个 错误
SQLSTATE[42S22]:未找到列:1054 '字段列表'中的未知列'staff.staff_id'(SQL:选择users.*、staff.staff_id 为pivot_staff_id、staff .user_id as pivot_user_id, staff.staff_type as pivot_staff_type, staff.role as pivot_role, @9876543@34@.created_at as @987654336.,@987654336. 987654338@ as pivot_updated_at from users inner join staff on users.id = staff.user_id 其中staff.@9876543647@ in (2) 和 @9865444@987654444 @ = 应用\模型\投资者)
//investor relationship
public function staff()
{
return $this->morphToMany(User::class, 'staff')
->withPivot(['role'])
->withTimestamps();
}
//user relationship
public function investors()
{
return $this->morphedByMany(Investor::class, 'staff');
}
【问题讨论】:
标签: php laravel laravel-5 laravel-4