Disciple liked a comment+100 XP
3mos ago
Hi everyone,
I'm trying to use UUIDs instead of ids on users table, it works fine but I can't login anymore, session is not created.
First I added a HasUuid trait (and use it in App\Models\User):
trait HasUuid
{
public static function booted(): void
{
parent::boot();
static::creating(function (Model $model): void {
$model->setAttribute('uuid', Str::orderedUuid());
});
}
}
Then I added these properties to my User class:
protected $primaryKey = 'uuid';
protected $keyType = 'uuid';
public $incrementing = false;
Of course, migrations has been updated:
- User migration : from
$table->id();to$table->uuid()->primary(); - Sessions migration : from
$table->foreignId('user_id')->nullable()->index();to$table->foreignUuid('user_id')->nullable()->index();
The issue is the same when I use other session storage. What did I miss?
Thanks :)
Disciple liked a comment+100 XP
3mos ago
@OccTherapist Publishing this with tag livewire:assets actually works for me. It's strange that I can't find this in documentation for Production deployment and I am working with latest Laravel/Filament setup.
Disciple liked a comment+100 XP
3mos ago
@OccTherapist thanks bro this was the solution for me
Disciple liked a comment+100 XP
3mos ago
Disciple liked a comment+100 XP
3mos ago
I was not checking the resources and now found out that the livewire js was not loading (giving 404) so i changed the resource path in appserviceprovide:
Livewire::setScriptRoute(function ( $handle ) {
return Route::get('/livewire/live-wire-js', $handle);
});
Now it is working fine...
incase someone else needs fixing...
Disciple liked a comment+100 XP
3mos ago
I am getting an error on the production server when I try to log in to the filament panel. Everything works fine on the local server.
On the local server, I tested the network call and surprisingly it is sending a post request to the route /livewire/update. When I try to log in on the production server it sends a post request to /admin/login and this route is not defined as I have checked the routes list.
Any idea what is going on here...