class Album extends Eloquent {
public function photos()
{
return $this->hasMany(Photo::class);
}
}
class Photo extends Eloquent {
public function album()
{
return $this->belongsTo(Album::class);
}
}
class AlbumController extends Controller {
...
public function show($id)
{
$album = Album::find($id);
return view('album')->with(['photos' => $album->photos]);
}
...
}