I want to correctly handle user store form.
I consider which patter will be the most correct/popular. It is repository pattern? Service pattern?
Another difficulty: User form: name, email, postal code, city, street. I want to create two models in one form: User and Address. How can I solve it? I throught about:
// UserController store(UserRequest $request)
$address = $addressRepo->create($request->validated());
$user = $userRepo->create($request->validated(), $address)
Issues i'm wondering about:
- UserRequest has data connected with user and address
I am confused as to what would be the most correct.