$student = Student::create(['nom' => $nom, 'type' => $type]);
$student->device()->create(['token' => $token]);
$student->save();
You also need to make sure the Student and Device models have
protected $fillable = ['nom', 'type']; // this allows the create method to work
protected $fillable = ['token'];
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community