• 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 can i hide dt if dd got empty value

How to convert a carbon into string, to take the date only?

Xdebug in Laravel is not working with VSCode

Destroy session upon refresh

Uncaught TypeError: Cannot read property 'length' of null when retrieving tags from wp

Unit (real unit test) of test laravel relationship

What is the function of the (new Date()).getTime() in PHP?

array_key_exists(): The first argument should be either a string or an integer

Laravel whole batch is cancelled if one Job fails

array_key_exists(): The first argument should be either a string or an integer

"Unable to load dynamic library 'pdo_sqlsrv.so' "Cenos7 PHP7.2.10

Handle error for duplicate entries - PHP/MySQL

Symfony Make:Migration : The metadata storage is not up to date, please run the sync-metadata-storage command to fix this issue

Check for PDO Results, If None Display Message, If Yes then Loop Through

Show rotation of tweets using current day of month

About Contact Privacy policy Terms and conditions