$image ]; $validator = Validator::make($data, [ 'avatar' => [ Rule::dimensions()->minWidth($minWidth)->minHeight($minHeight)->maxWidth($maxWidth)->maxHeight($maxHeight), 'max:' . $maxSize, 'min:' . $minSize ], ]); return !$validator->fails(); } public function createCollectionAndFileModelWithImage() { $collection = Collection::factory()->createQuietly([ 'alt_required' => false, 'description_required' => false, 'tmp_support' => true, 'max_width' => 2000, 'max_height' => 2000, 'min_width' => 1, 'min_height' => 1, 'min_file_size' => 0 ]); $uuid = app()->uuid; $file = File::factory()->createQuietly([ 'uuid' => $uuid, 'server_path' => '/' . date('y') . '/' . date('m') . '/', 'user_id' => auth()->id(), 'collection_id' => $collection->id ]); $this->createImageForModel($collection,$file); return ['file' => $file ,'collection' => $collection]; } }