|
123456789101112131415161718192021222324252627 |
- <?php
-
- namespace App\Models;
-
- use CodeIgniter\Model;
-
- class SurveyUserModel extends Model
- {
- protected $table = 'survey_user';
- protected $useTimestamps = true;
-
- protected $allowedFields = ['survey_id', 'user_id'];
-
- protected $validationRules = [
- 'survey_id' => 'required',
- 'user_id' => 'required',
- ];
-
-
- public function alreadyAnswered($surveyId, $userId)
- {
- return $this->where([
- 'survey_id' => $surveyId,
- 'user_id' => $userId,
- ])->countAllResults();
- }
- }
|