📜  laravel 工厂计数器 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:04.700000             🧑  作者: Mango

代码示例1
class OrderFactory extends Factory {
  private static $order = 1;     //Static iterator
  protected $model = Order::class;

  public function definition() {
    return [
        'counting_wow' => self::$order++    //Adds then Increments $order
    ];
  }
}