Package Data | |
---|---|
Maintainer Username: | axe |
Maintainer Contact: | shane369@gmail.com (An X) |
Package Create Date: | 2018-09-22 |
Package Last Update: | 2018-09-24 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-02-06 03:12:26 |
Package Statistics | |
---|---|
Total Downloads: | 1,150 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 3 |
Total Forks: | 1 |
Total Open Issues: | 1 |
GraphQL Upload middleware for Laravel and Lumen
This package is ported from https://github.com/Ecodev/graphql-upload
composer require axe/laravel-graphql-upload
example use with Folklore\GraphQL
'middleware' => [
Axe\LaravelGraphQLUpload\GraphqlUploadMiddleware::class
]
<?php
namespace App\GraphQL\Mutation;
use Axe\LaravelGraphQLUpload\UploadType;
use Folklore\GraphQL\Support\Mutation;
use GraphQL;
class UploadFileMutation extends Mutation
{
public function type()
{
return GraphQL::type('YourReturnType');
}
public function args()
{
return [
"file" => ['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
}
}