30 lines
949 B
PHP
30 lines
949 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
class UserSecurityQuestionAnswer extends BaseModel
|
|
{
|
|
use HasFactory;
|
|
protected $fillable = ['user_id','answer','question_id'];
|
|
public function addOrUpdateUserQuestion($inputData)
|
|
{
|
|
// $inputData1=['user_id'=>$inputData['user_id'],'question_id'=>$inputData['question_id'],'answer'=>$inputData['answer']];
|
|
|
|
$userQuestion = self::create($inputData);
|
|
return $userQuestion;
|
|
}
|
|
public function getUserSecurityQuestionAnswer($user_id)
|
|
{
|
|
// $questionAnswer=[];
|
|
// $questionAnswer = self::where('user_id',$user_id)->first();
|
|
// if(!empty($questionAnswer)) {
|
|
// $question = (new SecurityQuestion())->getSecurityQuestionById($questionAnswer['question_id']);
|
|
// $questionAnswer['question'] = $question;
|
|
// }
|
|
|
|
return self::where('user_id',$user_id)->first();
|
|
}
|
|
}
|