You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
648B

  1. <?php
  2. namespace App\Models;
  3. use CodeIgniter\Model;
  4. class RespuestaModel extends Model
  5. {
  6. protected $table = 'answers';
  7. protected $primaryKey = 'id';
  8. protected $useTimestamps = true;
  9. protected $allowedFields = ['survey_id', 'user_id', 'answer', 'question_id'];
  10. protected $validationRules = [
  11. 'survey_id' => 'required',
  12. 'user_id' => 'required',
  13. 'answer' => 'required',
  14. 'question_id' => 'required',
  15. ];
  16. public function getRespuestas($survey_id, $user_id)
  17. {
  18. return $this
  19. ->where(['survey_id' => $survey_id, 'user_id' => $user_id])
  20. ->findAll();
  21. }
  22. }