PHP code example of rymanalu / factory-generator

1. Go to this page and download the library: Download rymanalu/factory-generator 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/ */

    

rymanalu / factory-generator example snippets


Rymanalu\FactoryGenerator\FactoryGeneratorServiceProvider::class,



use App\Post;
use Faker\Generator as Faker;

$factory->define(Post::class, function (Faker $faker) {
    //
});



namespace App;

use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'text',
    ];
}



use App\Post;
use Faker\Generator as Faker;

$factory->define(Post::class, function (Faker $faker) {
    return [
        'text' => $faker->word,
    ];
});

php artisan make:factory "App\Post"