Laravel Relationships

September 5, 2020

#One to Many Relationship

Model Form

Model Step

Form can have multiple steps

You can define the relationship inside the Form model

public function steps()
{
        return $this->hasMany('App\Models\Step');
}

In your view file show.blade.php

@foreach ($form->steps as $step)
    <div>{{$step->name}}</div>
@endforeach