does anyone know why am I getting this error while creating datatable for my job category?
DatabaseSeeder.php
<?php
use Illuminate\Database\Seeder;
// Import DB and Faker services
use Illuminate\Support\Facades\DB;
use Faker\Factory as Faker;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
// \App\Models\User::factory(10)->create();
$faker = Faker::create();
foreach (range(1,150) as $index) {
DB::table('jobs')->insert([
'company' => $faker->company,
'category' => $faker->category,
'position' => $faker->position,
'description' => $faker->description,
'salary_from' => $faker->salary_from,
'salary_to' => $faker->salary_to,
'status' => $faker->status,
]);
}
}
}
my error is
InvalidArgumentException
Unknown formatter "category"
at C:\xampp\htdocs\job\vendor\fakerphp\faker\src\Faker\Generator.php:300
296▕ return $this->formatters[$formatter];
297▕ }
298▕ }
299▕
➜ 300▕ throw new \InvalidArgumentException(sprintf('Unknown formatter "%s"', $formatter));
301▕ }
302▕
303▕ /**
304▕ * Replaces tokens ('{{ tokenName }}') with the result from the token method call
1 C:\xampp\htdocs\job\vendor\fakerphp\faker\src\Faker\Generator.php:278
Faker\Generator::getFormatter("category")
2 C:\xampp\htdocs\ob\vendor\fakerphp\faker\src\Faker\Generator.php:497
Faker\Generator::format("category")
This is my first time creating datatable, and i am new to laravel, so after checking i found that using datatable is much simpler to generate data