I have a laravel list defined in my controller as follows:
$industries = Industry::lists('id', 'name');
$salaries = Salary::lists('id', 'range', 'rate');
How do I output or access the columns in blade templating?
I do the following and I get error 'trying to get property of non object':
@foreach ($industries as $industry)
<div class="checkbox margin-top-0 ">
<label>
{!! Form::checkbox('industry_list[]', $industry->id) !!}
{{$industry->name}}
</label>
</div>
@endforeach
How can I iterate using a for loop as well as I'm trying to determine the first iteration - using the below i get offset error.
@for ($i = 0; $i <= count($salaries); $i++)
<div class="checkbox @if($i == 0) margin-top-0 @endif ">
<label>
{!! Form::checkbox('salary_list[]', $salaries->id) !!}
{{$salaries->name}}
</label>
</div>
@endfor
And how do I iterate the $salaries array - do i need to make it a collection since Salary::lists('id', 'range', 'rate');
array only contains two columns and strangely when i do 'dd($salaries);` why is the array defined with the 'range' value as the key and the 'id' as the value despite it being declared with 'id' being the key?
array:33 [
"10,000 - 15,000" => 24
"15,000 - 20,000" => 25
]