• 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

WordPress Subquery returns more than 1 row on SELECT

SMTP ERROR: MAIL FROM command failed: 530 5.7.0 Must issue a STARTTLS command first when using PHPMailer

How should I get started using PHPUnit as a testing framework for a bunch of functions and classes I have already made?

PHP: Telegram Bot: Insert line break to text message

Laravel phpunit test failing authorization

how to youtube api data to print in toolset metabox using a button click before save-post

I need to link Google Sheet with my Laravel

How to run or debug php on Visual Studio Code (VSCode)

Smarty: undefined extension class 'Smarty_Internal_Method_Get_Template_Vars'

Composer Script echo

could not find driver Debian SQL Server PHP

printing all running session variable in laravel 5.1

Additional price based on cart item count in WooCommerce

Why do I have invalid argument supply for foreach in Laravel for json response? [duplicate]

Check if a string contain multiple specific words

About Contact Privacy policy Terms and conditions