Creating a user when a client is created.
I'm trying to make it so where whenever a client is created. It automatically makes the user record which it belongs to.
When the client gets created I run a notification that send out an email with the generated password.
I've edited the CreateClient record, but since I'm using ->relationship('user') I can't access the data from the form $data
2 Replies
For this o would probably use an observer:
https://laravel.com/docs/11.x/eloquent#defining-observers
Using this you can create a listener on your model so anytime a record is created you can run some code to send notifications ect.
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
Ohh, let me take a look at it. Didn't know that existed. Appreciate it