Support the ongoing development of Laravel.io →
Input Forms Validation
Last updated 2 years ago.
0

You are overriding your save method with a create method. Override create instead. Or even better, use a setter, a listener or a user creator service depending on your needs.

Last updated 2 years ago.
0

enkay, how do I do that?

Last updated 2 years ago.
0

You should definitely research these concepts on your own and what I'm going to describe is probably not the cleanest way to go about it but it'll set you in the right direction and depending on the size of your project it could work just fine.

  1. create a listeners.php file in your app directory
  2. require it in app/start/global.php under filters

listeners.php

User::creating(function($user) {
	$user->customfield = 'something';

	// custom logic that needs to happen on user creation
});
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

mstnorris mstnorris Joined 12 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.