I want to extend the default user model without having to use eloquent or database, for example to override the notifications methods to take a different approach to password reset notifications.
On discord @jasonvarga suggested it can be done if you:
- make a custom User class. you can extend Statamic\Auth\File\User
- make a custom user repository. you can extend Statamic\Stache\Repositories\UserRepository
- override the make method so that it returns your User.
- In a service provider, add this:
(new \Statamic\Auth\UserRepositoryManager)->extend('stache', function () {
return new YourCustomRepository;
});
This feels like quite a few steps, and it would be nice if it was simpler to do - ideally only one model and one change to service provider.
I want to extend the default user model without having to use eloquent or database, for example to override the notifications methods to take a different approach to password reset notifications.
On discord @jasonvarga suggested it can be done if you:
This feels like quite a few steps, and it would be nice if it was simpler to do - ideally only one model and one change to service provider.