Controlling Save Process

I understand that not everyone may want to have an og_image_url field in their model table. You may be using some other way to save the media and retrieve it. For example using spatie media library is one of best solutions when it comes to handling media. So you may want to use spatie media library and save the image to a collection of your chosing.

To facilitate this, the package provides the save process in a dedicated method which can be overridden from the model. The saving method receives a base64 version of the image as an argument. Below is an example of how you can save the OG images to a collection named graphify-image using media library.

public function saveGraphify($image): void

Last updated