假设,我有这些热情的模型
class User extends \LaravelBook\Ardent\Ardent
{
public $autoHydrateEntityFromInput = true;
protected $fillable = array('username', 'password', 'address');
protected $table = 'Users';
public static $relationsData = array(
'location' => array(self::HAS_ONE, 'Location');
}
class Location extends \LaravelBook\Ardent\Ardent
{
protected $fillable = array('address');
protected $table = 'Locations';
}
现在,当我编写这样的控制器代码时,
$user = new User;
$user->address = Input::get('address');
$user->push();
它不会将地址数据保存到地址表