PHP code example of marqant-lab / laravel-medialibrary-graphql

1. Go to this page and download the library: Download marqant-lab/laravel-medialibrary-graphql library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

marqant-lab / laravel-medialibrary-graphql example snippets



...
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
...
class User extends ... implements HasMedia
{
    use InteractsWithMedia;
    
    // ...

/**
     * Model(s) to attach media files to
     *
     * by default User model
     *
     * you can specify any model to attach media files
     */
    'models' => [
        'default' => config('auth.providers.users.model'),
        'one_more_model' => \Some\Namespace\Model::class,
    ],
schell script
php artisan migrate
shell script
php artisan vendor:publish --provider="Marqant\LaravelMediaLibraryGraphQL\Providers\LaravelMediaLibraryGraphQLServiceProvider" --tag=config
shell script
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="config"
xml
<testsuite name="LaravelMedialibraryGraphQL">
    <directory suffix="Test.php">./vendor/marqant-lab/laravel-medialibrary-graphql/tests</directory>
</testsuite>
shell script
php artisan test --group=GraphQLMediaLibrary
# or
phpunit --group=GraphQLMediaLibrary