PHP code example of wisdom-diala / countrypkg-laravel

1. Go to this page and download the library: Download wisdom-diala/countrypkg-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wisdom-diala / countrypkg-laravel example snippets


namespace App\Http\Controllers;

use Illuminate\Http\Request;
use WisdomDiala\Countrypkg\Models\Country;
use WisdomDiala\Countrypkg\Models\State;

class TestController extends Controller
{
    public function getAllCountries()
    {
    	$countries = Country::all();
    	return view('pages.countries', compact('countries'));
    }

    public function getAllStates()
    {
    	$states = State::all();
    	return view('pages.states', compact('states'));
    }
}

php artisan migrate

php artisan vendor:publish --tag=country_flags