Model alias support #2428
-
Do we have any way to use Model alias in custom guard.
This is my auth.php. Where \SubDealers::class is an alias of tbl_subdealer_master model which is available in
If I use the alias as model_type in roles table laravel does not attach role object in auth, but if I use the full model path it works. I would like to use the alias. Am I missing something? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
I wonder if it would work if you were to resolve the alias inside the |
Beta Was this translation helpful? Give feedback.
-
Are you registering it as a facade? or as an app alias? or how? |
Beta Was this translation helpful? Give feedback.
Sorry for the late response. Found another way to bind that with model. Which is written as secondary solution.
Solution 1
With enforceMorphMap
I had to write below code in AppServiceProvider.php 's boot method.
and below line in model file.
Solution 2 - Secondary Solution
I had to append one model attribute name as id to bind roles object with the model. This one may have flaws. I…