statamic / collaboration

Real-time, multi-user editing with Statamic via websockets
https://statamic.com/addons/statamic/collaboration
33 stars 12 forks source link

Call to undefined method App\Models\User::name() #75

Closed MtDalPizzol closed 7 months ago

MtDalPizzol commented 1 year ago

Hi folks. I'm trying out this package and the installation seem to be ok. But the UI gets stuck trying to connect to the socket.

image

Checking the network I can see that the /broadcasting/auth request is failing do to Call to undefined method App\Models\User::name().

I'm using the Eloquent Driver for the users and here's my configs:

// app/Models/User.php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;

class User extends Authenticatable
{
    use HasApiTokens, HasFactory, Notifiable;

    // ...
}
// config/auth.php

'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model' => App\Models\User::class,
        ],
]
//config/statamic/users.php

'repository' => 'eloquent',

I tried extending the User model from Statamic\Auth\Eloquent\User but this brought my server down.

JorisOrangeStudio commented 10 months ago

I'm experiencing the same issue, any updates yet?

JorisOrangeStudio commented 9 months ago

@MtDalPizzol Have you by any chance found a solution to this problem?

MtDalPizzol commented 9 months ago

@MtDalPizzol Have you by any chance found a solution to this problem?

Nope. I haven't worked on it anymore...

JorisOrangeStudio commented 9 months ago

@jasonvarga @jackmcdade @jesseleite @duncanmcclean Sorry to ask you all, but is this something that comes through eloquent Users in combination with Collaboration addon? I have the exact same issue as described above. I can add

public function name() {
    return $this->name;
    } 

but that causes other problems with registration and also requires id, initials, etc. to be added in this way. So don't think that is a proper solution. Looking forward to hear from you, since now I'm not able to use the Collaboration addon.