laravel-users icon indicating copy to clipboard operation
laravel-users copied to clipboard

Custom Users Model (not being honored?)

Open RomanoCodes opened this issue 4 years ago • 7 comments
trafficstars

I am using a user model with a custom table named defined: image

However when doing something like adding a new user, an error is thrown. The error seems to be spitting back the '.users' table which makes me think some kind of default is not being overridden. Is this the case? How can I fix this (while keeping my custom user table)?

Thanks!

RomanoCodes avatar Feb 02 '21 21:02 RomanoCodes

The users table is not defined in this package it all funs off the config file var:

https://github.com/jeremykenedy/laravel-users/blob/master/src/config/laravelusers.php#L39

Which is used in:

https://github.com/jeremykenedy/laravel-users/blob/master/src/App/Http/Controllers/UsersManagementController.php

by calling config('laravelusers.defaultUserModel').

You may need to clear composer and the config of your app.

jeremykenedy avatar Feb 03 '21 00:02 jeremykenedy

Despite clearing all forms of cache and even bouncing my apache server, I am still getting the following: image

Mind you, I have also specified the specific user model in the config file. I am at a loss.

RomanoCodes avatar Feb 03 '21 00:02 RomanoCodes

What line does it say it fails on with that stack trace in the laravel.log

jeremykenedy avatar Feb 03 '21 01:02 jeremykenedy

This issue is in the controller rules I believe.

I am not sure when I will have time to fix it but its the rules I think in these lines:

  • https://github.com/jeremykenedy/laravel-users/blob/master/src/App/Http/Controllers/UsersManagementController.php#L94
  • https://github.com/jeremykenedy/laravel-users/blob/master/src/App/Http/Controllers/UsersManagementController.php#L95
  • https://github.com/jeremykenedy/laravel-users/blob/master/src/App/Http/Controllers/UsersManagementController.php#L203

The issue is it calling the unique:users on those lines.

jeremykenedy avatar Feb 03 '21 01:02 jeremykenedy

I'm handed a bunch of things... I'm not sure if this will be helpful: image

image

Oddly, in the debug pane, it shows a query that seems correct: image

RomanoCodes avatar Feb 03 '21 01:02 RomanoCodes

You're right... I did some see some validator flags get raised. Thanks for maybe confirming that being the case... I can try to sidestep that and see what happens (when I have a moment later tonight). Will keep you posted.

RomanoCodes avatar Feb 03 '21 01:02 RomanoCodes

Great success. Stripping out the |unique:users solved the issue.

Thanks for your help on this (and of course all the other work you've done)!

RomanoCodes avatar Feb 03 '21 05:02 RomanoCodes