Skip to content

Faker-Pokemon is a Faker provider that generates fake pokemon data for you!

License

Notifications You must be signed in to change notification settings

Sourabh950/faker-pokemon

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation



Faker extension for Pokemon Fans.

Installation

composer require james-n-m/faker-pokemon

Basic usage

Laravel Factory

$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->keyItem()               // Pokedex 

To then use this factory within a seeder file. First, create a seeder file:

php artisan make:seeder PokemonTableSeeder

Open the seeder file and add the following. Use the factory that we created above for the App\UserPokemon model:

<?php

use Illuminate\Database\Seeder;

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

Finally, run the seeder:

php artisan db:seed --class=PokemonTableSeeder

About

Faker-Pokemon is a Faker provider that generates fake pokemon data for you!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%