我使用belongsTo()和hasMany()在两个模型之间建立了一对多的关系。hasMany()关系工作得很好,但是belongTo()不能工作。有人知道我在哪里犯的错吗?用户::查找(1)->medicine_type--它什么也不返回
class MedicineType extends Eloquent}
public function medicine
我把我的laravel 5.0升级到了5.3。在那之后,ORM joins就完全不起作用了。有没有什么建议可以解释为什么它不工作?我遵循了的所有指令 public function CompanyDataGet() return $this->belongsTo('App\Model','id','othert
current_user (a foreign key to User model)public function currentUser() return $this->belongsToget: fn($value) => User::find($value)->full_name(), );他们同名,不工作另外,我试图更改它们的名称,但是Laravel无法识别它们并返回一个n
我有一些代码在我的本地机器(WAMP,PHP5.4.3)上工作得很好,但在生产服务器(CentOS,PHP5.4.11)上却不能正常工作,我不明白为什么,令人不快的代码行是:Argument 2 passed to Illuminate\Database\Eloquent\Relations\BelongsToDatabase\Eloquent\Collection, instance of
ItemL