You need not to use mutator to set the Auth:id()
for new model instance. Checkout the Eloquent event to set Auth::id()
as user_id
during the creation of new model instance.
For Post
model code sample will
Don't Forget to register the service provider
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community