4
4
4sadly2020-09-15 19:26:13
Laravel
4sadly, 2020-09-15 19:26:13

How to create a model with 2 links?

The user belongs to the department and to its creator, how to quickly create this user?

$staff->users()->create(); //Автоматически положит staff_id, а надо положить creator_id вместе с ним, как это быстро можно сделать?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Adamos, 2020-09-15
@Adamos

$staff->users()->create([ 'creator_id' => $creator->id ]);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question