If you have rules setup on each models it should work ok.
Alternatively, you could ditch ardent and use a Validation Service Class instead, to validate your input in one place.
I have rules set up for each model but it is not saving the form data. How should my form be set up for the additional models to pass through correctly?
For example, here is my admin notes form field:
{{ Form::textarea('adminNotes[notes]', $user->adminNotes->notes, array('class' => 'form-control', 'id' => 'notes', 'rows' => 3)) }}
My user model:
public function adminNotes()
{
return $this->hasOne('AdminNote');
}
My admin notes model:
use LaravelBook\Ardent\Ardent;
class AdminNote extends Ardent {
protected $fillable = array('user_id', 'notes');
public static $rules = array(
'notes' => 'required'
);
public function user()
{
return $this->belongsTo('User', 'user_id', 'id');
}
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community