Student.php
它有很多费用
class student extends Model{
public function fees($round){
return $this->hasMany(fee::class)->where('payment_round','=',$round);
}
}
Fee.blade.php
@foreach($student->fees("parameter") as $fee)
{{$fee->myproperty}}
@endforeach
我如何将参数传递给$student->费用(“参数”)?
最佳答案 尝试类似的东西:
@foreach($student->fees($parameter)->get() as $fee)
{{ $fee->myproperty }}
@endforeach
我认为你把相关模型费用的收集与查询构造函数费用混淆了().