Laravel Lumen in Docker ClassLoader Exception

Viewed 81

I installed a fresh Lumen in my docker container. Next I wanted to use eloquent so I activated it and it worked with some tests.

My problem now is if I want to get some Information about the model I've created, most of the times I get an error from the ClassLoader:

"include(/var/www/html/app/Models/Group.php): Failed to open stream: No such file or directory"

The file is obviously there, if I start the request again 1-2 / 10 times it worked. Finds the class and loads all things.

The Model itself has no special stuff in it, just an empty class.

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Group extends Model
{
}

In my controller I'm using the model like this:

<?php

use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use App\Models\Group;

class TestController extends Controller
{
    public function getGroups(Request $request): JsonResponse
    {
        return response()->json(['groups' => Group::all()]);
    }
}

It looks like it has something to do with docker?

Hope someone can help.

Thanks in advance!

0 Answers
Related