Laravel : How to Create Dropdown to Select FOREIGN KEY from Other Table?



PHP Snippet 1:

public function create()
{
    $doas =  Doas::all();

    return view('note/create', compact('doas'));
}

PHP Snippet 2:

<div class="container">
    <label class="form-label text-white" style="font-weight: bold;" for="doa">Doa terkait</label>
    <select class="form-select" style="color: #41A7A5" aria-label="Default select example">
        @foreach ($doas as $doa)
            <option value="{{$doa-id>}}">{{$doa->name}}</option>
        @endforeach
    </select>
</div>