put('php://temp', $attributes['file']); return $file; } /** * Prepare the given value for storage. * * @param \Illuminate\Database\Eloquent\Model $model * @param string $key * @param \App\Models\Address $value * @param array $attributes * @return array */ // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceAfterLastUsed,Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed public function set($model, $key, $value, $attributes) { if (!$value instanceof UploadedFile) { throw new InvalidArgumentException( 'The given value is not an ' . UploadedFile::class . ' instance.' ); } /** @var \Illuminate\Http\UploadedFile */ $value = $value; return [ 'file' => $value->get() ]; } }