Skip to content

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

License

Notifications You must be signed in to change notification settings

fabiofdsantos/laracountries

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

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).

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages