Good morning, every body, I'm searching how to call a controller's function in my seeding file.
Account Controller
public function createCompte() { //generate an account number return $numcompte; } }
planter
public function run(){ $compteController = new CompteController; $numcompte = $this->compteController->createCompte(); $data_client = [ //other data generate with faker 'num_cmpte_client' => $numcompte , ]; $id_client = $this->db->table('client')->insert($tab); }
As @Pippo pointed out in the comments :
so;
instead of: ❌
Use this:✅
references: