Created
October 28, 2017 19:35
-
-
Save deleugpn/6190278cfe313c7849d2a5d3513d4549 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * @param $class | |
| * @param array $attributes | |
| * @param int $times | |
| * @return mixed | |
| */ | |
| function create($class, $attributes = [], $times = 1) | |
| { | |
| $data = factory($class)->times($times)->create($attributes); | |
| if ($times > 1) { | |
| return $data; | |
| } | |
| return $data->first(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment