• 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

PHP Discord OAUTH2 code sample not working

Get latest Tweets - What API

Laravel excel maatwebsite 3.1 import, date column in excel cell returns as unknown format number. How to solve this?

browsersync doesn't work with XAMPP

Passing PHP JSON to Javascript: echo json_encode vs echo json declaration

Error Class "LaravelFortifyFeatures" not found

Sort multidimensional array by column value within a column

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

PHP Download MP3 files from directory on server

Reducing authentication calls on external API (Laravel 5.6)

Laravel: Create morphs() relationship nullable

Unable to Edit config.inc.php

Dynamic table in HTML using MySQL and php

Transpose and flatten two-dimensional indexed array where rows may not be of equal length

Insert database rows from columns of data from associative array of indexed arrays

About Contact Privacy policy Terms and conditions