Controller:
public function getMyInvest() {
$myInvest = Invest::->where('user_id', Session::get('id_user'))->get();
return view('invest.my-invest', ['invests' => $myInvest]);
}
Вывод в view:
@foreach($invests as $invest)
<tr>
<th scope="row">{{$invest->id}}</th>
<td>{{$invest->tarif_id->name}}</td>
<td>{{$invest->created_at}} - 16.03.18</td>
<td>{{$invest->sum}}руб.</td>
<td><a class="glyphicon icon-remove" href="" > </a></td>
</tr>
@endforeach
И сама модель:
class Invest extends Model
{
public $timestamps = false;
public function tarif_id() {
return $this->hasOne('App\Models\Invest_tarif', 'id');
}
}
В чем причина ошибки