我以这种方式尝试,但没有取消关系
模型入场
awk '
{
sub(/[[:space:]]+$/,"")
}
FNR==NR{
a[FNR]=tolower($0)
next
}
{
for(i=1;i<=NF;i++){
count=a[i]==tolower($i)?++count:count
}
if(count==length(a)){
print "Line number " FNR " whose contents are:" $0 " present in both the files."
}
else{
print "Line number " FNR " is NOT matching..."
}
count=""
}' Input_file2 Input_file1
Dossiersocial模型
public function dossierscocial(){
return $this->hasOne('\App\Dossierscocial');
}
在我看来
public function admission(){
return $this->belongsTo('\App\Admission');
}
答案 0 :(得分:0)
因为hasOne
返回的对象不是collection
,所以不能使用foreach
。
只有一个对象,您可以像这样使用它:
@if(isset($admission->dossiersocials))
<tr>
<td>{{$admission->dossiersocials->id}}</td>
<td>{{$admission->dossiersocials->user_id}}</td>
<td>{{$admission->dossiersocials->patient_id}}</td>
<td>{{$admission->dossiersocials->admission_id}}</td>
<td>{{$admission->dossiersocials->nationalite}}</td>
</tr>
@endif
或者您可以使用hasMany
代替hasOne