Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/james-n-m/faker-pokemon
A Faker provider that generates fake pokemon data for you! :candy:
https://github.com/james-n-m/faker-pokemon
faker-provider laravel php pokemon
Last synced: 3 days ago
JSON representation
A Faker provider that generates fake pokemon data for you! :candy:
- Host: GitHub
- URL: https://github.com/james-n-m/faker-pokemon
- Owner: James-N-M
- License: mit
- Created: 2019-09-20T01:55:25.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-15T15:54:22.000Z (over 4 years ago)
- Last Synced: 2024-05-03T10:29:25.087Z (6 months ago)
- Topics: faker-provider, laravel, php, pokemon
- Language: PHP
- Homepage: https://packagist.org/packages/james-n-m/faker-pokemon
- Size: 37.1 KB
- Stars: 16
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Faker extension for Pokemon Fans.## Installation
```php
composer require james-n-m/faker-pokemon
```## Basic usage
### Laravel Factory
```php$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```
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
create_count)->create();
}
}
```Finally, run the seeder:
```
php artisan db:seed --class=PokemonTableSeeder
```