jet

Call to undefined function create()

Posted 2 weeks ago by jet

this is the PostsTableSeeder

<?php

use Illuminate\Database\Seeder;

class PostsTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        factory(App\Post::class, 30)-create();
    }
}

DatabaseSeeder

<?php

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
         $this->call(PostsTableSeeder::class);
    }
}

PostsFactory

use Faker\Generator as Faker;

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

    return [
        'title' => $faker->sentence(50),
        'category_id' => $faker->text(50),
        'content' => $faker->paragraph(50),
        'order' => $faker->text(50),
        'views' => $faker->text(50),
        'status' => $faker->text(50),
        'slug' => $faker->url(50),
        'meta ' => $faker->text(50),

    ];
});

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.