PHP code example of james-n-m / faker-pokemon

1. Go to this page and download the library: Download james-n-m/faker-pokemon 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/ */

    

james-n-m / faker-pokemon example snippets


composer 


$factory->define(UserPokemon::class, function (Faker $faker) {

    $faker->addProvider(new \Faker\Provider\FakerPokemon($faker));

    return [
        ...
    ];

$faker->pokemonName;            // Pikachu
$faker->pokemonCharacterName;   // Ash Ketchum
$faker->pokemonType;            // Fire
$faker->pokemonLocation;        // Pallet Town
$faker->pokemonMove;            // Quick Attack
$faker->pokemonQuote('oak')     // Your very own tale of grand adventure is about to unfold
$faker->pokeball()              // Safari Ball
$faker->item()                  // Rare Candy
$faker->keyItem()               // Pokedex 




use Illuminate\Database\Seeder;

class PokemonTableSeeder extends Seeder
{
    public $create_count = 5;
    
    public function run()
    {
        factory(App\UserPokemon::class, $this->create_count)->create();
    }
}

php artisan make:seeder PokemonTableSeeder

php artisan db:seed --class=PokemonTableSeeder