codeigniter 4 db seed

Solutions on MaxInterview for codeigniter 4 db seed by the best coders in the world

showing results for - "codeigniter 4 db seed"
Emmanuel
22 Jun 2017
1> php spark db:seed TestSeeder
2
Nawel
18 Nov 2018
1<?php namespace App\Database\Seeds;
2
3class SimpleSeeder extends \CodeIgniter\Database\Seeder
4{
5        public function run()
6        {
7                $data = [
8                        'username' => 'darth',
9                        'email'    => 'darth@theempire.com'
10                ];
11
12                // Simple Queries
13                $this->db->query("INSERT INTO users (username, email) VALUES(:username:, :email:)",
14                        $data
15                );
16
17                // Using Query Builder
18                $this->db->table('users')->insert($data);
19        }
20}
21
Henri
03 Oct 2019
1<?php namespace App\Database\Seeds;
2
3class TestSeeder extends \CodeIgniter\Database\Seeder
4{
5        public function run()
6        {
7                $this->call('UserSeeder');
8                $this->call('CountrySeeder');
9                $this->call('JobSeeder');
10        }
11}
12