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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

“未定義的屬性:Illuminate\View\Engines\CompilerEngine::$

“未定義的屬性:Illuminate\View\Engines\CompilerEngine::$

PHP
九州編程 2021-09-05 20:57:57
我收到此錯(cuò)誤Undefined property: Illuminate\View\Engines\CompilerEngine::${"id":1,"title":"abddad","description":"abddad.","created_at":"2019-06-27 22:25:18","updated_at":"2019-06-27 22:25:18"} (View: /home/vagrant/projectos/projectofinal/ProjectoFinal/resources/views/index.blade.php)代碼如下:@foreach (\App\Award::all()->take(3) as $award)  <div class="row">    <div class="col-lg-12">       <ul class="timeline">          @if (count($this->$award) === 2)          <li>          <div class="timeline-image">            <img class="rounded-circle img-fluid" src="img/awards/medal.png">          </div>          @else           <li class="timeline-inverted">          <div class="timeline-image">            <img class="rounded-circle img-fluid" src="img/awards/medal.png">          </div>          @endif          <div class="timeline-panel">                        <div class="timeline-heading">              <h4 class="subheading">{{ $award->title }}</h4>            </div>            <div class="timeline-body">              <p class="text-muted">{{ $award->description }}</p>            </div>                    </div>        </li>      </ul>           </div>  </div>  @endforeach如果我使用 $award 而不是 $this->award我有錯(cuò)誤:count(): Parameter must be an array or an object that implements Countable (View: /home/vagrant/projectos/projectofinal/ProjectoFinal/resources/views/index.blade.php)在第 5 行獲取錯(cuò)誤異?!癅if (count($this->$award) === 2)”我應(yīng)該怎么做?希望這有助于 dd($award):  Award {#692 ▼  #fillable: array:2 [?]  #connection: "mysql"  #table: "awards"  #primaryKey: "id"  #keyType: "int"  +incrementing: true  #with: []  #withCount: [] #perPage: 15 +exists: true +wasRecentlyCreated: false #attributes: array:5 [?] #original: array:5 [?] #changes: [] #casts: [] #dates: [] #dateFormat: null #appends: [] #dispatchesEvents: [] #observables: [] #relations: [] #touches: [] +timestamps: true #hidden: [] #visible: [] #guarded: array:1 [?]}
查看完整描述

2 回答

?
白板的微信

TA貢獻(xiàn)1883條經(jīng)驗(yàn) 獲得超3個(gè)贊

以下代碼通過(guò)變量 $award ($this->$award) 的值調(diào)用 $this 的屬性意味著如果 $award 確實(shí)包含 $this 的字符串匹配屬性,您應(yīng)該獲取該屬性的值。

相反, $award 包含一些看起來(lái)像字符串化的 json 對(duì)象的東西

{"id":1,"title":"abddad","description":"abddad.","created_at":"2019-06-27 22:25:18","updated_at":"2019-06-27 22:25:18"}

然而 $this 不包含這樣的變量。

嘗試在第 5 行執(zhí)行以下代碼,應(yīng)該可以

@if (count($award) === 2)


查看完整回答
反對(duì) 回復(fù) 2021-09-05
?
寶慕林4294392

TA貢獻(xiàn)2021條經(jīng)驗(yàn) 獲得超8個(gè)贊

我是這樣解決的

@if (($award->id) % 2 == "0")

謝謝您的幫助!


查看完整回答
反對(duì) 回復(fù) 2021-09-05
  • 2 回答
  • 0 關(guān)注
  • 201 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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