data(); foreach ($data as $value) { Role::create([ 'name' => $value['name'], ]); } } public function data() { return [ ['name' => 'admin'], ['name' => 'editor'], ]; } }