I have two table the first called codes, and second is company.
Codes table structure:
id| title | desc | company | order
Company table structure:
id| name
Here is code from my controller
$codes= DB::table('codes')->orderBy('company', 'ASC')->get();
$company = Company::all();
return view('codes.index',compact('codes', 'company'));
And here is codes from my view.
@foreach($codes as $code)
<tr>
<td>{{$code->title}}</td>
<td>{{$code->code}}</td>
<td>{{$company->name}}</td>
<td>{{$code->order}}</td>
</tr>
@endforeach
I can not get name of company. How is possible? Thanks for all
$codeson your controller, how can you get$codeson blade ?