2017-01-08 5 views
1

今日、私は何も見つからなかった場合、私は友好のメッセージを表示することができますが、私はLaravelからこのエラーを取得しておくことを確認するために、カウントをチェックしようとしていますLaravel - 予期しない「:」「(」

Parse error: syntax error, unexpected ':', expecting '(' (View: C:\Users\User\workspace\websites\website\resources\views\frontend\community\government.blade.php) 

期待?私が追加したときに起こります。

@if ($governmentRole->stats->count() < 1) 

私は文の場合、それが正常に動作することを削除すると

ここgovernment.blade.phpでforeachのです:

<div class="panel panel-info"> 
    <div class="panel panel-body"> 
     @if ($juniorGovernment->count() < 1) 
      We couldn't find any government roles for this category. 
     @else 
      @foreach($juniorGovernment as $governmentRole) 
       @if ($governmentRole->stats->count() < 1) 
        There are currently no candigates working in this category. 
       @elseif 
        @foreach($governmentRole->stats as $governmentMember) 
         <div class="col-md-10"> 
          <div class="col-md-12" style="margin-left:-40px;"> 
           <div class="col-md-1" style="margin-top:-16px;"><img src="http://mywebsite.com/avatar.php?figure=ch-3030-92.hr-681-34.hd-209-8.lg-3116-106-1408&size=b&direction=3&head_direction=3"></div> 
           <div class="col-md-9" style="margin-left:40px;"> 
            <h4>{{ $governmentMember->user->username }} <small>{{ $governmentRole->government_title }}</small></h4> 
            <p><font color="#aaa">{{ $governmentRole->government_department }}</font></p><br> 
           </div> 
          </div> 
         </div> 
        @endforeach 
       @endif 
      @endforeach 
     @endif 
    </div> 
</div> 

Government.blade.phpコントローラ:

<?php 

namespace App\Http\Controllers\Frontend\User; 

use Auth; 
use Cache; 
use Illuminate\Http\Request; 
use App\Database\Website\User\Roleplay; 
use App\Database\Website\Roleplay\GovernmentRole; 
use App\Database\Website\Roleplay\Life\LifeEvents; 

class GovernmentController 
{ 
    public function getView() 
    { 
     $royalty = GovernmentRole::where('government_type', 'royalty'); 

     $higherGovernment = GovernmentRole::where('government_type', 'higher_government')->get(); 

     $seniorGovernment = GovernmentRole::where('government_type', 'senior_ministers')->get(); 

     $juniorGovernment = GovernmentRole::where('government_type', 'junior_ministers')->get(); 

     return view('frontend.community.government', compact('juniorGovernment', 'seniorGovernment', 'higherGovernment', 'royalty')); 
    } 
} 

答えて

0

私はあなたのコードは次のようif statement一部を更新する必要があると思う:あなたのため、この作品を願っています

@if(count($governmentRole->stats) < 1)

@if ($governmentRole->stats->count() < 1)

関連する問題