Support the ongoing development of Laravel.io →
posted 10 years ago
Eloquent
Last updated 2 years ago.
0

Parent is a reserved keyword in php. It refers to the parent class.

Last updated 2 years ago.
0

The code is an example of what I am trying to do, not the actually code i'm using.

Last updated 2 years ago.
0
$p = Parent::find(1);
$child = new Child([
  'key' => 'value',
]);
$p->child()->save($child);

http://laravel.com/docs/eloquent#inserting-related-models

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

korazy8s korazy8s Joined 26 Jun 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.