Support the ongoing development of Laravel.io →
Database
Last updated 2 years ago.
0
$def = Def::where("abc_id", $abc->id)

or if there is a "hasOne(Def)" or "hasMany(Def)" relationship defined in Abc model

$def = $abc->def
Last updated 2 years ago.
0

afte find a row we have to update a row... but if i use where method..then we can not use update method like for that we have to use find methd. $def->update($fields); if i use where method then error is HTTPRequest Error :: 500: {"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Call to undefined method Illuminate\Database\Eloquent\Collection::update()","file":"D:\wamp\www\doc2door\app\D2D\Repositories\PatientRoutineRepository.php","line":40}}:error

Thanks HARSH SHAH

Last updated 2 years ago.
0
$def = Def::where("abc_id", $abc->id)->first()

this of course means, that there is (or shoukd be) one-to-one relationship between abc and def

Last updated 2 years ago.
0

Thanks a lot!!!! TorchSK

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

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.