1

im trying to deploy my laravel-project via forge and digitalocean. And while it is working perfectly fine in my local development enviroment, im having a hard time getting the laravel-websockets package running.

So while my "CruiseCrontroller" is functioning perfectly locally, somehow in production is giving me following error.

[2020-12-22 15:42:00] production.ERROR: Class 'App\Events\newRoom' not found {"exception":"[object] (Error(code: 0): Class 'App\\Events\newRoom' not found at /home/forge/default/app/Http/Controllers/CruiseController.php:49)

this is the mentioned line in the CruiseController:

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use App\Events\newRoom;
use App\Events\RoomStatusUpdate;
use App\Room;
use App\Sailor;
use Carbon\Carbon;

class CruiseController extends Controller
{
    public function newRoom(Request $request){
   
    ...
    event(new NewRoom($room->channel_id));
}
...

I googled and searched through stackoverflow for 2h now and hope someone here can point me in the right direction. Thank you

N. Kue
  • 77
  • 1
  • 7
  • what does `newRoom` look like? Also, judging by its class name, it might violate PSR-4/0 which would prevent it from being added to the autoloader in composer 2 – Derek Pollard Dec 22 '20 at 16:57
  • 1
    also, keep in mind, you've imported `newRoom` but then called `new NewRoom` which doesn't exist – Derek Pollard Dec 22 '20 at 16:58
  • 1
    Be consistent in your naming and case usage... You have `App\Events\RoomStatusUpdate`, which is the correct case, but also `App\Events\newRoom`, which is incorrect case. That should be `NewRoom`, which your referenced correctly below. It's all over the place :P – Tim Lewis Dec 22 '20 at 17:01

1 Answers1

1

Case is important in case sensitive filesystems. You import the following class:

use App\Events\newRoom;

while you should import

use App\Events\NewRoom;

The autoloader tries to find the newRoom.php file and fails to do it because the file with that name doesn't exist.

Chris Cynarski
  • 493
  • 3
  • 9