Laravel Userstamps provides an Eloquent trait which automatically maintains `created_by` and `updated_by` columns on your model, populated by the currently authenticated user in your application.
I've found a bug in the getUserClass function, when using this via API.
I got the following error:
"message": "Call to a member function getModel() on null",
"exception": "Symfony\\Component\\Debug\\Exception\\FatalThrowableError",
"file": "/home/vagrant/code/dw-client-portal/vendor/wildside/userstamps/src/Userstamps.php",
"line": 151,
But when aa user has a User class which is not the default User model, it will conflict. So I've changed it to: (so it always takes from your auth.php)
protected function getUserClass()
{
return config('auth.providers.users.model');
}
As far as I know (Laravel > 5.*), default User class is in the namespace App, otherwise its configured in your auth.php. So what I've did is a check on class App\\User, and otherwise it takes the class from your auth.php. But this was not a good solution since a developer can also have a User model in their App namespace which is not their default User model, so I've changed it to take it from your config file called auth.php
I think this is a better way to get the Auth Provider class. I'll make a PR in a bit.
Hi WildSideUK,
Tayfun here again!
I've found a bug in the
getUserClass
function, when using this via API.I got the following error:
The function (now):
I've changed it to:
But when aa user has a User class which is not the default User model, it will conflict. So I've changed it to: (so it always takes from your auth.php)
As far as I know (Laravel > 5.*), default User class is in the namespace
App
, otherwise its configured in yourauth.php
. So what I've did is a check on classApp\\User
, and otherwise it takes the class from yourauth.php
. But this was not a good solution since a developer can also have a User model in theirApp
namespace which is not their default User model, so I've changed it to take it from your config file calledauth.php
I think this is a better way to get the Auth Provider class. I'll make a PR in a bit.
Looking forward to your reply!
Cheers,
Tayfun Kayahan