A ContentFactory an abstract class is used to generate new content objects for you. These include
You can instantiate a factory by using the
create() method in the corresponding data type’s API class.
To create a
Statamic\API\Entry::create(), and so on.
Once you have a factory instance, you can chain the methods on the factory.
The following methods are available on this class (and therefore on subclasses).
The order of the content. For instance, pages can have a number. Entries can have a number, date, or no order, depending on the type of collection they’re in.
Data objects will be able to determine their paths automatically under most conditions. Use this to specify it manually.
Whether this should be published. Accepts a boolean.
Add an array of data to the object. “Create an object with this data.”
$factory->with(['foo' => 'bar', 'baz' => 'qux']);