• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

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

phpmysqllaravel


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>

Related Snippets

Reducing authentication calls on external API (Laravel 5.6)

What will the best solution for this multiple optional filter?

printing all running session variable in laravel 5.1

Match csv filenames to table names and import

Create a new line whenever an array value reaches more than 10 characters

add uri parameter to Route name in laravel

No result using makeStyles Material UI in react 18

Too few arguments to function PendingResourceRegistration::name(),1 passed in C:xampphtdocsproject outesweb.php on line 18 and exactly 2 expected

MySQL/PHP - Web Based Game -User specific inventory table or 1 giant table? Another option?

jQuery Ajax Post with data

Fetch files from next cloud storage and display in Laravel website

Laravel Blade checkbox not checked

Laravel php artisan serve to mimic HTTPS

Server-sent events in PHP (without echo or print)

Combine array with same value and add other [duplicate]

About Contact Privacy policy Terms and conditions