I have two types of user: client
, manager
. are stored in separated tables.
Each of then have unique nickname.
So, I need to open profile by nickname
.
For Client is:
$client = Client::where("nickname", $nickname)
For Manager is:
$manager = Manager::where("nickname", $nickname)
So, I try to make universal function that dewtect where is client and manager and execute the appropriate query.
How can I improve this code and detect type of user only by nickename?