withDependency() : $class::factory(); $factory = empty($smash) ? $factory : $factory->smash($smash); $model = $factory->make($attrs)->makeVisible((new $class())->getHidden()); return $model->toArray(); return Arr::except($model->toArray(), $model->getAppends()); } public function one($class, $attributes = [], $dependencyAttributes = []) { return $class::factory()->withDependency($dependencyAttributes)->createQuietly($attributes); } public function randomOne($class) { return $class::inRandomOrder()->first(); } public function trashed($class, $dependencyAttributes = []) { $model = $this->one($class,dependencyAttributes:$dependencyAttributes); $model->delete(); $this->assertSoftDeleted($model); return $model; } }