各位早上好, 我正在搜索如何在我的播种文件中调用控制器的函数。
帐户控制器
public function createCompte() { //generate an account number return $numcompte; } }
播种机
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); }
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
正如@Pippo指出的在评论中:
所以;
而不是:❌
使用这个:✅
参考文献: