'Authenticate non-user models in addition to users

In the application I'm developing there are two types of Users.

The first one is a conventional type of user with a record in the DB.

The second one uses a different model and needs to be authenticated manually in a controller - App\Models\Contact

I want to avoid going for custom sessions since I'd like to find out how to authenticate that model in a way that it can take advantage of the already created and implemented Route middleware and lots of Policies.

I am thinking:

  1. Either somehow authenticate the Contact class itself.
  2. Better yet, somehow create a non-persisting dummy User model for the Contact who's trying to log in and authenticate them.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source