• 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

How To Access A Column In M-M Relationship Table In Laravel

How to fix " Uncaught TypeError: Argument 1 passed to JpGraphException::defaultHandler() " problem in php 7.1.3 and jpgraph 4.2.6?

Is there a way to use the same parameter into multiple place in the same query with Eloquent? [duplicate]

get data-value with variable value

Create a zip file and download it

Adding hreflang tags automatically in WordPress subdirectory multisite

Match csv filenames to table names and import

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

Laravel get user data with profile

str_replace or preg_replace random number from string

Laravel Multi-language routes without prefix

Issue with laravel eloquent model property

Comma separated list from array with "and" before last element

Losing session data after POST from third party website

Laravel Gates using model and returns "Using $this when not in object context" Line 28 of AzureUser model

About Contact Privacy policy Terms and conditions