Laravel Lookup Value in Table
<p>I've used some guides online to populate a dropdown box from the database by using the pluck function. This works in create, but when viewing the table and showing the record it only shows the ID not the lookup value from the table it's referencing. I've tried returning the data into the customers.show and altering the view but cannot get it to work.</p>

<p>Controller:</p>

<pre><code>    public function show($id)
  {
        $company = Companies::find($id);
        $customers = $this-&gt;customersRepository-&gt;findWithoutFail($id);

        if (empty($customers)) {
            Flash::error('Customers not found');

            return redirect(route('customers.index'));
        }

        return view('customers.show')
        -&gt;with('customers', $customers)
        -&gt;with('company', $company);
    }
</code></pre>

<p>Then the view:</p>

<pre><code>&lt;!-- Company Id Field --&gt;
&lt;div class="form-group"&gt;
    {!! Form::label('company_id', 'Company Id:') !!}
    &lt;p&gt;{!! $company-&gt;name !!}&lt;/p&gt;
&lt;/div&gt;
</code></pre>

<p>I also believe i have the correct relationship setup in the model:</p>

<pre><code> public function company()
    {
        return $this-&gt;belongsTo(\App\Models\Company::class);
    }
</code></pre>

<p>I believe something is wrong with the <code>$company = Companies::find($id)</code> I want it to find the field customers.company_id. If i manually type in the ID of the record from the companies table e.g. 1 it returns data correctly.</p>

<p>In the customers table there's a column company_id which is constrained to the companies table column ID.
Thanks</p>