Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel factory counter

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
    ];
  }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #laravel #factory #counter
ADD COMMENT
Topic
Name
1+5 =