vendredi 6 janvier 2017

How to create Eloquent model with relationship?

How to create Eloquent model with relationship?

I have:

Person table

id
firstname
lastname

Employee table

id
person_id
position

I want to do something like this:

Employee::create([
'firstname' => 'Jack',
'lastname' => 'London',
'position' => 'writer'
])

I know, that can create two model and then associate their. But may be there is a way do this more beautiful?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2iMnec5
via IFTTT

Aucun commentaire:

Enregistrer un commentaire