Skip to content

Instantly share code, notes, and snippets.

@tilhom
Created June 30, 2018 12:40
Show Gist options
  • Save tilhom/625e022bb05fe4d0b49851544fc3f6f9 to your computer and use it in GitHub Desktop.
Save tilhom/625e022bb05fe4d0b49851544fc3f6f9 to your computer and use it in GitHub Desktop.
factory for Comment (for: Using Laravel 5.5 Resources to create your own {JSON:API} formatted API)
<?php
use Faker\Generator as Faker;
$factory->define(App\Comment::class, function (Faker $faker) {
return [
'article_id' => $faker->numberBetween(1,200),
'author_id' => $faker->numberBetween(1,100),
'body' => $faker->text()
];
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment