标签:min compose san conf cad extend users ble php
提前配置测试数据
php artisan make:seeder UserTableSeeder
write random data
<?php
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class UserTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table(‘users‘)->insert([
‘name‘=>str_random(10),
‘email‘=>str_random(10).‘@gmail.com‘,
‘password‘=>bcrypt(‘secret‘),
]);
}
}
and config run in DatabaseSeeder.php
public function run()
{
$this->call([
UserTableSeeder::class,
]);
}
composer dump-autoload
php artisan db:seed
标签:min compose san conf cad extend users ble php
原文地址:https://www.cnblogs.com/cyany/p/10126118.html