There are several ways to insert data:
public function run()
{
DB::table('users')
->insert([
'name' => 'Taylor',
'age' => 21
]);
}
public function run()
{
$user = new User;
$user->name = 'Taylor';
$user->save();
}
public function run()
{
User::create([
'name' => 'Taylor',
'age' => 21
]);
}
public function run()
{
factory(App\User::class, 10)->create();
}
public function run()
{
DB::table('users')->delete();
DB::unprepared('ALTER TABLE users AUTO_INCREMENT=1;');
factory(App\User::class, 200)->create();
}
See the Persisting example for more information on inserting/updating data.