# Developing and Securing GraphQL APIs with Laravel

**URL:** <https://community.auth0.com/t/developing-and-securing-graphql-apis-with-laravel/22565>\
**Category:** Blog Discussions\
**Tags:** graphql, laravel\
**Created:** [March 13, 2019, 10:12am UTC](https://community.auth0.com/t/developing-and-securing-graphql-apis-with-laravel/22565 "2019-03-13T10:12:21Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramiro](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ramiro/32/8077_2.png) [@ramiro](https://community.auth0.com/u/ramiro)\
**Post date:** [March 13, 2019, 10:12am UTC](https://community.auth0.com/t/developing-and-securing-graphql-apis-with-laravel/22565/1 "2019-03-13T10:12:21Z")

</div>

Learn how to develop GraphQL APIs with Laravel and how to secure them with Auth0.

Read on 🛠\>\> [How to Develop and Secure GraphQL APIs with Laravel PHP](https://auth0.com/blog/developing-and-securing-graphql-apis-with-laravel)

 ![Developing%20and%20Securing%20GraphQL%20APIs%20with%20Laravel](https://global.discourse-cdn.com/auth0/original/2X/2/29951bb890740730faca6f58460239ef9893e88d.png)

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [August 30, 2019, 11:34am UTC](https://community.auth0.com/t/developing-and-securing-graphql-apis-with-laravel/22565/2 "2019-08-30T11:34:25Z")

</div>

Let us know if you have any questions regarding the article, by reopening this community topic!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [August 30, 2019, 11:34am UTC](https://community.auth0.com/t/developing-and-securing-graphql-apis-with-laravel/22565/3 "2019-08-30T11:34:26Z")

</div>



---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [September 7, 2019, 4:04pm UTC](https://community.auth0.com/t/developing-and-securing-graphql-apis-with-laravel/22565/4 "2019-09-07T16:04:58Z")

</div>



---

<div class="post-metadata">

**Author:** ![hisashiyamaguchi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/hisashiyamaguchi/32/15175_2.png) [@hisashiyamaguchi](https://community.auth0.com/u/hisashiyamaguchi)\
**Post date:** [November 30, 2019, 7:01am UTC](https://community.auth0.com/t/developing-and-securing-graphql-apis-with-laravel/22565/5 "2019-11-30T07:01:22Z")

</div>

If I try to do ‘php artisan migrate:fresh --seed’ on my terminal, I get following exceptions.

Dropped all tables successfully.  
Migration table created successfully.  
Migrating: 2014\_10\_12\_000000\_create\_users\_table  
Migrated: 2014\_10\_12\_000000\_create\_users\_table (0.02 seconds)  
Migrating: 2014\_10\_12\_100000\_create\_password\_resets\_table  
Migrated: 2014\_10\_12\_100000\_create\_password\_resets\_table (0.02 seconds)  
Migrating: 2019\_03\_10\_201800\_create\_wines\_table  
Migrated: 2019\_03\_10\_201800\_create\_wines\_table (0.01 seconds)  
Migrating: 2019\_08\_19\_000000\_create\_failed\_jobs\_table  
Migrated: 2019\_08\_19\_000000\_create\_failed\_jobs\_table (0.01 seconds)

Illuminate\Contracts\Container\BindingResolutionException : Target class [WinesTableSeeder] does not exist.

at /Users/hisashiyamaguchi/winestore/vendor/laravel/framework/src/Illuminate/Container/Container.php:805  
801|  
802| try {  
803| $reflector = new ReflectionClass($concrete);  
804| } catch (ReflectionException $e) {

> 805| throw new BindingResolutionException(“Target class [$concrete] does not exist.”, 0, $e);  
> 806| }  
> 807|  
> 808| // If the type is not instantiable, the developer is attempting to resolve  
> 809| // an abstract type such as an Interface or Abstract Class and there is

Exception trace:

1 ReflectionException::(“Class WinesTableSeeder does not exist”)  
/Users/hisashiyamaguchi/winestore/vendor/laravel/framework/src/Illuminate/Container/Container.php:803

2 ReflectionClass::\_\_construct(“WinesTableSeeder”)  
/Users/hisashiyamaguchi/winestore/vendor/laravel/framework/src/Illuminate/Container/Container.php:803

Please use the argument -v to see more details.

Any ideas?

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 2, 2019, 7:41am UTC](https://community.auth0.com/t/developing-and-securing-graphql-apis-with-laravel/22565/6 "2019-12-02T07:41:07Z")

</div>

Hey there @hisashiyamaguchi!

I’m sure @andrea.chiarelli who is the article author will look at your struggles to provide some help, once he’s online!

---

<div class="post-metadata">

**Author:** ![andrea.chiarelli](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/andrea.chiarelli/32/16034_2.png) [@andrea.chiarelli](https://community.auth0.com/u/andrea.chiarelli)\
**Post date:** [December 2, 2019, 8:45am UTC](https://community.auth0.com/t/developing-and-securing-graphql-apis-with-laravel/22565/7 "2019-12-02T08:45:49Z")

</div>

Hi @hisashiyamaguchi,  
Just a few questions that come to my mind:

- have you created the `WinesTableSeeder` class in the `database/seeds` folder? (I think the answer is yes, but I ask just to be sure 🙂)
- Do you have the same error also with the code downloaded from the [Github repository](https://github.com/auth0-blog/laravel-graphql)?
- Which version of Laravel are you using?

Please, let me know.

---

<div class="post-metadata">

**Author:** ![fa-repo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/fa-repo/32/17548_2.png) [@fa-repo](https://community.auth0.com/u/fa-repo)\
**Post date:** [July 26, 2020, 2:36pm UTC](https://community.auth0.com/t/developing-and-securing-graphql-apis-with-laravel/22565/8 "2020-07-26T14:36:48Z")

</div>

A heads up for anyone getting the error:

_Declaration of App\GraphQL\Queries\UserQuery::type() must be compatible with Rebing\GraphQL\Support\Field::type(): GraphQL\Type\Definition\Type_.

You must add return types to the methods.

e.g.

```
use GraphQL\Type\Definition\Type;

// ✅

public function type(): Type
{
  return GraphQL::type('User');
}

public function args(): Array
{
    return [
        ...
    ]
}

// ❌

public function type()
{
  return GraphQL::type('User');
}

public function args()
{
    return [
        ...
    ]
}

```

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [July 27, 2020, 2:02pm UTC](https://community.auth0.com/t/developing-and-securing-graphql-apis-with-laravel/22565/9 "2020-07-27T14:02:49Z")

</div>

Thanks for providing that tip @fa-repo!

---

<div class="post-metadata">

**Author:** ![w.ptucky](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/w.ptucky/32/30910_2.png) [@w.ptucky](https://community.auth0.com/u/w.ptucky)\
**Post date:** [August 3, 2021, 8:08pm UTC](https://community.auth0.com/t/developing-and-securing-graphql-apis-with-laravel/22565/11 "2021-08-03T20:08:35Z")

</div>

// ./app/Http/Middleware/CheckAccess.php

I have an Error: Class ‘Auth0\SDK\JWTVerifier’ not found in file.  
How to fix this ? I am using laravel 8.x

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [August 4, 2021, 11:06am UTC](https://community.auth0.com/t/developing-and-securing-graphql-apis-with-laravel/22565/12 "2021-08-04T11:06:39Z")

</div>

Tagging @andrea.chiarelli for visibility

---

<div class="post-metadata">

**Author:** ![andrea.chiarelli](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/andrea.chiarelli/32/16034_2.png) [@andrea.chiarelli](https://community.auth0.com/u/andrea.chiarelli)\
**Post date:** [August 5, 2021, 7:49am UTC](https://community.auth0.com/t/developing-and-securing-graphql-apis-with-laravel/22565/13 "2021-08-05T07:49:33Z")

</div>

Thank you @fa-repo for the heads-up and @konrad.sopala for tagging me.  
We will plan to update the article soon.
