Laravel 5.4无法找到名称为[factory]的工厂

I know that this question already ask many times on this forum but the answer on that thread is not working on my end so I need to create new.

I am having this error when creating a seeding data my factory code is below.

Seeding class code:

 public function run() {

      factory(AppName\Models\Subscription::class, $datas)->create();

 }

My factory code:

$factory->define(AppName\Models\Subscription::class, function (Faker $faker) {

    $subscription_id = AppName\Models\Subscription::pluck('id')->toArray();

    $datetime = $faker->dateTimeBetween($startDate = '2017-08-01 12:00:00', $endDate = '2017-09-30 12:00:00', $timezone = date_default_timezone_get());

    return [
        'subscription_id' => $faker->numberBetween($min = min($subscription_id), $max = max($subscription_id)),
        'status' => 'sent',
        'created_at' => $datetime,
        'updated_at' => $datetime

    ];
});

I got this error:

Unable to locate factory with name [default] [AppName\Models\Subscription].

Even If I change the model name I got the same error with the same Model name

Unable to locate factory with name [default] [AppName\Models\Subscription].

this may be very late. But for people who faces this issue think this will help,

add

factory(\AppName\Models\Subscription::class, $datas)->create();

instead of

factory(AppName\Models\Subscription::class, $datas)->create();