gianmarx
1 month ago
232
8
Laravel

factory two functions in one

Posted 1 month ago by gianmarx

i have two fields in the poll table:

$table->id(); $table->text('status'); $table->timestamps();

status field can have three values A, B, C.

I would like to make a factory that first creates the tuples with status = A, then status = B etc.

if do factory (10)->create (); it creates me 10 tuples with status = A and 10 with status = B

how could I write the function public function definition() in factory ?

Please sign in or create an account to participate in this conversation.