Create a custom user model
Moonguard comes with its own user model (it has a default structure with some modifications), but you will most likely want to use your project's user model. If that's the case, the next section will help you make the necessary changes to the Moonguard configuration.
Follow the next steps to adapt your own User model to use MoonGuard features:
- Create a
Userclass must extends fromIlluminate\Database\Eloquent\Modeland implements theTaecontrol\MoonGuard\Contracts\MoonGuardUsercontract. - The
Userclass must declareuse Notifiable. - The
Userclass have to implement all the properties and methods required, you can guide yourself with the originalUser.phpmodel from Moonguard. - Replace the new
Usermodel class in the configuration file.