Here in this documentation Laravel Inserting Related Model there is no method to update the current related model. Have a look: Relation Between two Models
private function UserToken($token,$expire,$user_id){
if($JetUserPass=JetUserPass::find($user_id)->token){
$JetT = new JetTokens(['id_token' =>$token,'expires_on'=>$expire]);
$JetUserPass2=JetUserPass::find($user_id);
$JetUserPass2->token()->save($JetT);//NOT WORKING
}else{
$JetT = new JetTokens(['id_token' =>$token,'expires_on'=>$expire]);
$JetUserPass=JetUserPass::find($user_id);
$JetUserPass->token()->save($JetT);
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire