ModelFactory
in package
Returns new or shared Model instances
Tags
Table of Contents
- get() : mixed|null
- Creates new Model instances or returns a shared instance
- injectMock() : mixed
- Helper method for injecting mock instances while testing.
- reset() : mixed
- Resets the static arrays
Methods
get()
Creates new Model instances or returns a shared instance
public
static get(string $name[, bool $getShared = true ][, ConnectionInterface $connection = null ]) : mixed|null
Parameters
- $name : string
-
Model name, namespace optional
- $getShared : bool = true
-
Use shared instance
- $connection : ConnectionInterface = null
Return values
mixed|null —injectMock()
Helper method for injecting mock instances while testing.
public
static injectMock(string $name, object $instance) : mixed
Parameters
- $name : string
- $instance : object
Return values
mixed —reset()
Resets the static arrays
public
static reset() : mixed