Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/axe-me/laravel-graphql-upload

GraphQL Upload middleware for Laravel and Lumen
https://github.com/axe-me/laravel-graphql-upload

Last synced: 28 days ago
JSON representation

GraphQL Upload middleware for Laravel and Lumen

Awesome Lists containing this project

README

        

# laravel-graphql-upload
GraphQL Upload middleware for Laravel and Lumen

This package is ported from https://github.com/Ecodev/graphql-upload

## Install
```bash
composer require axe/laravel-graphql-upload
```

## Usage
> example use with _Folklore\GraphQL_

### in the config/graphql file, use the middleware
```php
'middleware' => [
Axe\LaravelGraphQLUpload\GraphqlUploadMiddleware::class
]
```

### in your mutation:
```php
['name' => 'file', 'type' => UploadType::type()],
];
}

public function rules()
{
return [
'file' => 'required|file|mimes:csv,txt',
];
}

public function resolve($root, $args)
{
$file = $args['file'];

// call some function
$path = $file->getRealPath();

// ... your logic here
}
}
```