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: 4 months ago
JSON representation
GraphQL Upload middleware for Laravel and Lumen
- Host: GitHub
- URL: https://github.com/axe-me/laravel-graphql-upload
- Owner: axe-me
- License: mit
- Created: 2018-09-22T06:07:13.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-09-24T15:48:35.000Z (almost 7 years ago)
- Last Synced: 2025-03-20T05:37:44.748Z (4 months ago)
- Language: PHP
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# laravel-graphql-upload
GraphQL Upload middleware for Laravel and LumenThis 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
}
}
```