• 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

Best way to scrolldown onpageload

How can i hide dt if dd got empty value

How can I make a full text index of the column?

How to properly start Laravel 8 with Bootstrap & authentication

SQL to convert multiple rows into a single row of variable length

How to KeyBy where multiple items have the same key

What is my SQL missing?

How to set a domain name with php artisan serve

str_replace or preg_replace random number from string

Elasticsearch - Want to sort by field in all indices where that particular field available or not if not then avoid it

Upgrade PHP on AWS Linux

how to pass row id in href of a tag in codeigniter controller?

Vimeo API: how to save a vimeo into a subfolder?

Declaration of OMDb::query(string $statement) must be compatible with PDO::query

Laravel get user data with profile

About Contact Privacy policy Terms and conditions