I'm trying to seed my table with some data with belongsTo relationship but I don't know how I should do this relationship. Can anybody tell me how an belongsTo relationship should look like with seeding real data?
Seeding file:
public function run()
{
CarSchema::create([
'type_of_car' => 'small',
'horse_power' => 98,
'brand' => 3 // Want to get the brand of id 3 here
])
}
The result I want is that "brand" is what corresponds to id 3 in the brand table so in the front End I've got the brand as well and not just the id of it.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire