Skip to content

confused about multiple databases #3221

Answered by AntonLugtenburg
jeff-h asked this question in Q&A
Discussion options

You must be logged in to vote

You can also have a main database that stores media models for different model on different databases,

that would be done like this

namespace App\Models;

use Spatie\MediaLibrary\MediaCollections\Models\Media as BaseMedia;

class Media extends BaseMedia
{
    protected $connection = 'app';
}

And set this Model as default media model in the media library config...

In that case, every model would store and retrieve it from you app database

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jeff-h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants