PHPackages                             marqant-lab/laravel-medialibrary-graphql - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. marqant-lab/laravel-medialibrary-graphql

ActivePackage

marqant-lab/laravel-medialibrary-graphql
========================================

Package for assign and get media files with Eloquent models through GraphQL.

v0.0.17(5y ago)36686[2 issues](https://github.com/marqant-lab/laravel-medialibrary-graphql/issues)MITPHP

Since Aug 10Pushed 5y ago1 watchersCompare

[ Source](https://github.com/marqant-lab/laravel-medialibrary-graphql)[ Packagist](https://packagist.org/packages/marqant-lab/laravel-medialibrary-graphql)[ RSS](/packages/marqant-lab-laravel-medialibrary-graphql/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (6)Versions (18)Used By (0)

Laravel Medialibrary GraphQL
============================

[](#laravel-medialibrary-graphql)

This package contains GraphQL queries and mutations to manage any type of media files and make them attacheable to any given model.

About
-----

[](#about)

We use [Lighthouse](https://lighthouse-php.com/master/getting-started/installation.html)for GraphQL.

The management of the mediafiles is based on the [spatie/laravel-medialibrary](https://docs.spatie.be/laravel-medialibrary/v8/introduction/) package.

By default this package uses Model from config `auth.providers.users.model`for assign files.
But you can change this after publish package config and change `'laravel-medialibrary-graphql.models.default'` value.

Installation
------------

[](#installation)

Require the package through composer.

```
composer require marqant-lab/laravel-medialibrary-graphql
```

You will have to run the migrations to setup the media table.

```
php artisan migrate

```

Publish the configuration.

```
php artisan vendor:publish --provider="Marqant\LaravelMediaLibraryGraphQL\Providers\LaravelMediaLibraryGraphQLServiceProvider" --tag=config
```

In this config you can specify a model to assign files to ('models.default') and many other settings. The model should implements `Spatie\MediaLibrary\HasMedia`interface and use `Spatie\MediaLibrary\InteractsWithMedia` trait.

For example User model:

```
