ffsantos92/
laracountries
g4t.io

Country Migrations and Seeds for Laravel

by Eric L. Barnes

Fábio Santos created a complete list of country migrations and seeders for Laravel. This is handy when you need them in the database but sometimes all you need…

README from ffsantos92/laracountries Open on GitHub →

Laracountries

Migration and seed files with all countries for Laravel PHP Framework.

The country codes are in the format ISO 3166-1 alpha-2.

A Simple Example of Use (Laravel 5)

Model

<?php

use Illuminate\Database\Eloquent\Model;

class Country extends Model
{
    protected $table = 'countries';
    public $timestamps = false;
}

Controller

/**
 * Show the form for creating a new resource.
 *
 * @return View
 */
public function create()
{
    $countries = Country::all();

    return view('myview', compact('countries'));
}

View

<select class="form-control" name="country">
    <option value="">Select a country</option>
    @foreach($countries as $country)
        <option value="{{ $country->id }}">{{ $country->name }}</option>
    @endforeach
</select>

License

See the LICENSE file for license rights and limitations (MIT).

More from the ecosystem

marcreichel/
laya-php
g4t.io
3 53

LayaPHP: Self-Hosted Text Classification for PHP and Laravel

Classify text in PHP without an LLM bill: typed decisions in 100+ languages, self-hosted. Laravel-ready SDK for Laya, a Jev AI alternative.

ai classification decision-engine
marcreichel/laya-php via Laravel News
Josh-Dovey/
postcodes-laravel
g4t.io
5 9

Postcodes for Laravel: GB Postcode Lookup and Geography Data

Postcodes for Laravel adds typed GB postcode lookups, validation, geography data, distance searches, and test fakes through the GB Postcodes API.

Josh-Dovey/postcodes-laravel via Laravel News
RedberryProducts/
mailbox-for-laravel
g4t.io
4 115

Mailbox for Laravel: Preview and Test Rendered Email

Mailbox for Laravel captures outgoing mail in a local dashboard and lets you test rendered HTML, recipients, and attachments with fluent assertions.

RedberryProducts/mailbox-for-laravel via Laravel News