From 1c747cb5c8801f8530906b22a9cf5566f531b525 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 1 Oct 2020 15:36:42 +1000 Subject: [PATCH] Converting L7 model factories to L9 L8 --- database/factories/AccountFactory.php | 34 ++++++++++++++++++++------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/database/factories/AccountFactory.php b/database/factories/AccountFactory.php index 8d964cada456..78017ca57e60 100644 --- a/database/factories/AccountFactory.php +++ b/database/factories/AccountFactory.php @@ -10,13 +10,31 @@ */ namespace Database\Factories; -use Faker\Generator as Faker; +use App\Models\Account; +use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Str; -$factory->define(App\Models\Account::class, function (Faker $faker) { - return [ - 'default_company_id' => 1, - 'key' => Str::random(32), - 'report_errors' => 1, - ]; -}); +class AccountFactory extends Factory +{ + /** + * The name of the factory's corresponding model. + * + * @var string + */ + protected $model = Account::class; + + /** + * Define the model's default state. + * + * @return array + */ + public function definition() + { + return [ + 'default_company_id' => 1, + 'key' => Str::random(32), + 'report_errors' => 1, + ]; + } + +}