Closed coactethan closed 1 year ago
The issue I'm facing here is related to the Entry::validateMaxEntryPerUserRequirement()
function. The logic on line 203 tests the number of answers by each user against the entry limit. This seems a little unintuitive as answering one question with an Entry limit of 1 would trigger throw new MaxEntriesPerUserLimitExceeded();
.
@coactethan thanks for using laravel-survey. The Entry
model that comes with the package is structured for processing one full entry after user has gone through all the questions, but I think you may be able to override it.
To do that, I would:
Entry
class that extends the model from the package to override the validation logic:
use MattDaneshvar\Survey\Models\Entry as BaseEntry;
class Entry extends BaseEntry { // Override methods as needed }
2. Bind my custom implementation in `AppServiceProvider`:
```php
public function register() {
$this->app->bind(\MattDaneshvar\Survey\Contracts\Entry::class, \App\Models\Entry::class);
}
Would this do the trick for you?
@matt-daneshvar Thanks, this worked perfectly.
I would like to be able to allow my users to answer my survey one section at a time, but they are only allowed to complete the survey once. Currently, this throws a MaxEntriesPerUserLimitExceeded exception. Is it within the realms of laravel survey to only throw this exception once the survey has been completed and all questions answered?
If not, could you point me in the right direction for allowing this?