第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

試圖獲取非對象的屬性“Nom”

試圖獲取非對象的屬性“Nom”

PHP
慕碼人2483693 2022-10-09 19:55:48
所以,我的代碼中有一些錯誤,當(dāng)我輸入姓名、專業(yè)和城市時,我希望搜索框能工作,但它不再工作了,所以這是我的控制器代碼: public function chercher (Request $request) {    $doctors=medecin::orderBy('created_at','desc')->get();    $rech=$request->get('rech');    $spec=$request->get('spec');    $ville=$request->get('Région');     $S=medecin::orderBy('created_at','desc')->get()      ->where('Spécialité',$spec) ;     $SV=medecin::orderBy('created_at','desc')->get()     ->where('Spécialité',$spec)      ->where('Ville',$ville);             $SN=medecin::orderBy('created_at','desc')->get()      ->where('Spécialité',$spec)      ->where('Nom',$rech) ;     $SNV=medecin::orderBy('created_at','desc')->get()      ->where('Spécialité',$spec)      ->where('Nom',$rech)      ->where('Ville',$ville);     $V=medecin::orderBy('created_at','desc')->get()      ->where('Ville',$ville);     $N=medecin::orderBy('created_at','desc')->get()      ->where('Nom',$rech);     $NV=medecin::orderBy('created_at','desc')->get()      ->where('Nom',$rech)      ->where('Ville',$ville) ;      return view ('doctors' ,['doc'=> $doctors,$S,$SV,$SN,$SNV,$V,$N,$NV],['tab'=>[$rech,$spec,$ville]]); }這是視圖:{{$tab[0]}}{{$tab[1]}}{{$tab[2]}} <ul>  @if($tab[1]=='Dentiste' && $tab[2]=='Tunis' && $tab[0]=='' )      @foreach($doc[0] as $show)<h1> Dr.{{$show->Nom}} {{$show->Prénom}}  </h1> </br> <h1> {{$show->Photo}} </h1><h1>{{$show->Spécialité}} </h1><h1>{{$show->Ville}}</h1>@endforeach @elseif($tab[1]=='' && $tab[2]=='' )    @foreach($doc[2] as $show)   <h1> Dr.{{$show->Nom}} {{$show->Prénom}}  </h1> </br> <h1> {{$show->Photo}} </h1><h1>{{$show->Spécialité}} </h1><h1>{{$show->Ville}}</h1>@endforeach@elseif ($tab[0]=='' && $tab[2]='')@foreach ($doc[7] as $show)<h1> {{$show->Nom}} {{$show->Prénom}}  </h1> </br> <h1> {{$show->Photo}} </h1><h1>{{$show->Spécialité}} </h1><h1>{{$show->Ville}}</h1>@endforeach如果我單擊搜索按鈕,則會出現(xiàn)此錯誤:試圖獲取非對象的屬性“Nom”(查看:C:\xampp\htdocs\Doctor\resources\views\doctors.blade.php)
查看完整描述

1 回答

?
aluckdog

TA貢獻1847條經(jīng)驗 獲得超7個贊

在你看來,

@foreach($doc[0] as $show)

應(yīng)該

@foreach($doc as $show)

因為你應(yīng)該迭代醫(yī)生的數(shù)組。

通過做

@foreach($doc[0] as $show)

相反,您正在迭代一個醫(yī)生對象的屬性,這不是您想要的。


查看完整回答
反對 回復(fù) 2022-10-09
  • 1 回答
  • 0 關(guān)注
  • 139 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號