2017-12-06 17 views
0

これは私のコントローラです。

public function index() 
{ 
    $customers = $this->customerType->whereNull('deleted_at')->paginate(10); 
    // please write the view code 
    return view('admin.customer_type.index')->with(['customers' => $customers]); 
} 

は、ブレードfile.someoneに私にそのエラーを表示し、感謝

<fieldset> 
    <label for="visible">Department</label><br> 
    <input name="hasDepartment" type="radio" value="ture" {!! $customers->hasDepartment == 'ture' ? 'checked' : '' !!}> True<br> 
    <input name="hasDepartment" type="radio" value="false" {!! $customers->hasDepartment == 'false' ? 'checked' : '' !!}> False 
</fieldset> 
+0

あなたのデータをループし、顧客オブジェクトの 'hasDepartment()' menthodをループします。 –

答えて

0

$customersが実際にページネータのインスタンスである、あなたがそうのようなすべての$customerを使用するようにするforeachする必要がありますしてくださいことを解決:

@foreach ($customers as $customer) 
    <fieldset> 
     <label for="visible">Department</label><br> 
     <input name="hasDepartment" type="radio" value="ture" {!! $customer->hasDepartment == 'ture' ? 'checked' : '' !!}> True<br> 
     <input name="hasDepartment" type="radio" value="false" {!! $customer->hasDepartment == 'false' ? 'checked' : '' !!}> False 
    </fieldset> 
@endforeach 
関連する問題