1. Go to this page and download the library: Download anahkiasen/fakable 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/ */
anahkiasen / fakable example snippets
use Fakable\FakableModel;
class MyModel extends Eloquent
{
use FakableModel;
}
class User extends Eloquent
{
/**
* The fakable attributes
*
* @var array
*/
protected $fakables = array(
'nationality' => 'countryCode',
'timzeone' => ['numberBetween', [1, 415]],
);
}
> User::fake()->toArray();
array(
'id' => 28,
'name' => 'Tempore ipsa aut dolorum sit quod.',
'slug' => 'tempore-ipsa-aut-dolorum-sit-quod',
'age' => 23,
'biography' => 'Culpa debitis dolorem quidem eius. Quis et voluptatibus est. Quia nulla rerum expedita magnam.',
'email' => '[email protected]',
'website' => 'http://www.weissnat.com/',
'address' => '91274 Schmitt Light Suite 378',
'country' => 'Sudan',
'city' => 'North Twila',
'private' => false,
'nationality' => 'RU'
)
User::fakable()
->setPool(10, 20) // Will generate 10 to 20 entries
->setPoolFromModel('Discussion', 2) // Will generate 2 users for every discussion
->setSaved(false) // Won't save anything to the database
->fakeModel() // Generated a single fake model, that's what ::fake() calls
->fakeMultiple() // Generate multiple models from the pool set previously