• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How To make Seeder in fake data ?

#1
Hello everyone! I having a bad time trying to use Seeder Fake data

My SettingSeeder

PHP Code:
<?php namespace App\Database\Seeds;
use 
App\Models\SettingModel;
use 
CodeIgniter\Database\Seeder;
use 
CodeIgniter\Test\Fabricator;
use 
Faker\Factory;

class 
SettingSeeder extends Seeder
{    
    
public function run()
    {
        
$faker Factory::create();        
        $formatters 
= [
            
'settingname' => $faker->name,
            
'about_us'    => $faker->text,
            
'mission'     => $faker->text,
            
'vision'      => $faker->text,
        ];
        
        $fabricator 
= new Fabricator(SettingModel::class, $formatters);
        
$fabricator->create();
    }


Code:
php spark db:seed SettingSeeder

CodeIgniter CLI Tool - Version 4.0.4 - Server-Time: 2020-07-19 07:16:45am

Unknown formatter "Zackary"
C:\laragon\www\ci4\vendor\fzaninotto\faker\src\Faker\Generator.php - 248

what is wrong ?
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.