I am using two eloquent models alpha and beta. I am having trouble with the controller and the view. Alpha is designed to have multiple betas and their is a hasMany relationship established. When redirected to the show page they should see the alpha and the beta data by alpha_id. The code I am currently using is pulling an error and after looking in the book and online I can not figure out how to fix it.
Here is the controller code:
public function display($alpha_id)
{
return View::make('alpha.show')->with([
'alpha' => $this->alphaRepository->findBy($alpha_id),
$alpha->alphaRecord->getBeta(),
]);
}
Here is the view:
<p>{{ $alpha }}</p>
@foreach($alpha->Betas() as $beta)
<p>Beta: <br />{{ $beta }}</p>
@endforeach