You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
508 B
30 lines
508 B
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
|
|
use App\Models\Address;
|
|
use App\Models\User;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class UsersTableSeeder extends Seeder
|
|
{
|
|
const DATA_PATH = __DIR__ . '/../data/users.json';
|
|
/**
|
|
* Run the database seeds.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run()
|
|
{
|
|
$data = json_decode(file_get_contents(self::DATA_PATH), true);
|
|
|
|
|
|
collect($data)->map(function ($userData) {
|
|
|
|
User::query()->create($userData);
|
|
});
|
|
|
|
}
|
|
}
|