<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;

class UserSecurityQuestion extends BaseModel
{
    use HasFactory;
    protected $fillable = ['user_id','answer_id'];
    public function addOrUpdateUserQuestion($inputData)
    {
        $inputData1=['user_id'=>$inputData['user_id'],'answer_id'=>$inputData['answer1']];
        $inputData2=['user_id'=>$inputData['user_id'],'answer_id'=>$inputData['answer2']];
        $inputData3=['user_id'=>$inputData['user_id'],'answer_id'=>$inputData['answer3']];
        $userQuestion1 = self::create($inputData1);
        $userQuestion2 = self::create($inputData2);
        $userQuestion3 = self::create($inputData3);
        return [$userQuestion1,$userQuestion2,$userQuestion3];
    }
    public function  getUserSecurityQuestionAnswer($user_id)
    {
        $questionAnswer=[];
        $questionAnswer = self::where('user_id',$user_id)->get();
        return $questionAnswer;
    }
}
