Blog Detail Pic

Set Default In Spatie Media Library

by Kwilio | Apr 15, 2021

There are many cases where you would need to set a default fall back image in your Spatie media library url. An example is user avatars or client photos. This tutorial will teach you how to do that.


1. In your module at the top add the following class

use Spatie\MediaLibrary\MediaCollections\File;

2. Add the following function to your Model

public function registerMediaCollections(): void

Thats it!