Coder Social home page Coder Social logo

laravel-survey's Introduction

👷‍♂️ Now making:

  • Nimble Links – Redirect clicks evenly, randomly, or based on other parameters.

laravel-survey's People

Contributors

jorporte avatar matt-daneshvar avatar mend-bolt-for-github[bot] avatar mrchimp avatar stojankukrika avatar stylecibot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-survey's Issues

Error on migrate

On fresh laravel/filament install
when run php artisan migrate - error: Cannot declare class CreateSurveysTable, because the name is already in use..

CVE-2020-11023 (Medium) detected in phpunit/php-code-coverage-7.0.14, jquery-3.4.1.min.js

CVE-2020-11023 - Medium Severity Vulnerability

Vulnerable Libraries - phpunit/php-code-coverage-7.0.14, jquery-3.4.1.min.js

phpunit/php-code-coverage-7.0.14

Library that provides collection, processing, and rendering functionality for PHP code coverage information.

Library home page: https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/bb7c9a210c72e4709cdde67f8b7362f672f2225c

Dependency Hierarchy:

  • orchestra/testbench-v3.9.4 (Root Library)
    • orchestra/testbench-core-v3.9.8
      • fzaninotto/faker-v1.9.2
        • phpunit/phpunit-8.5.15
          • phpunit/php-code-coverage-7.0.14 (Vulnerable Library)
jquery-3.4.1.min.js

JavaScript library for DOM operations

Library home page: https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js

Path to vulnerable library: laravel-survey/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/jquery.min.js

Dependency Hierarchy:

  • jquery-3.4.1.min.js (Vulnerable Library)

Vulnerability Details

In jQuery versions greater than or equal to 1.0.3 and before 3.5.0, passing HTML containing elements from untrusted sources - even after sanitizing it - to one of jQuery's DOM manipulation methods (i.e. .html(), .append(), and others) may execute untrusted code. This problem is patched in jQuery 3.5.0.

Publish Date: 2020-04-29

URL: CVE-2020-11023

CVSS 3 Score Details (6.1)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: Required
    • Scope: Changed
  • Impact Metrics:
    • Confidentiality Impact: Low
    • Integrity Impact: Low
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-11023

Release Date: 2020-04-29

Fix Resolution: jquery - 3.5.0


Step up your Open Source Security Game with WhiteSource here

Need help about multi steps

Hi, could anyone help me about multi steps form?

my app have 108 questions, all of which are mandatory. The first 8 questions are the basic information of the client filling in, including text type and radio type. The next 100 questions are for analysis, all of which are radio types. now i got single page form working, but not for multi steps.

I plan to split into 8+20+20+20+20+20 steps, how to adjust blade file? i defined function for step number increase, and the variables for blade file, something like this:

$step1 = $survey->questions->slice(0, 8, true);
$step2 = $survey->questions->slice(8, 20, true);
$step3 = $survey->questions->slice(28, 20, true);
$step4 = $survey->questions->slice(48, 20, true);
$step5 = $survey->questions->slice(68, 20, true);
$step6 = $survey->questions->slice(88, 20, true);

@if($currentStep == 1)
@foreach($step1 as $key => $question)
@include('survey::questions.single')
@Endforeach
@endif

but not working, maybe related to pass variables between steps, please give some details about how to do multi steps?

Curiosity about the `for` method

Hi,

I found your approach really interesting but, I don't understand the Entry::for(... method.
It's a non-static method being called as a static one, that will not work I'm afraid.

support for Multi Choice

First of all thanks for the amazing work you have done.

It'd be appreciated if ability of multichoice questions (entries) added to the library.

Partial surveys don't work with entry limits

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?

How to show view

I want to show view but you not describe which variable i have to pass in view and how your pagination work

gamify after answer

Hello
please is there anyway to migrate your package with this package https://github.com/qcod/laravel-gamify i already use it and i want to use it with your package
i tried this :
$d = (new Entry)->for($survey)->by(Auth::user())->fromArray($answers)->push();
givePoint(new SurveyAnswered($d));
in the my controller and in push method in entry model i returned to $this
Could you help me please ?

Participant ID is null

Hi Matt, my participant ID is coming through as null when i create an entry. I have seen a similar question asked before and you said to put this (new Entry)->for($survey)->by($user)->fromArray($answers)->push();. But my issue is i do not know where to put this in to resolve this issue

Star Rating

Can you please add a feature to have star ratings out of 5 stars along with results i.e. the average star rating that all the users gave? It would be very helpful.

Creating survey with non-authenticated user

Hello everyone,

I have been trying to using Survey package with authenticated users, and I have already could get this.
but What I'm asking about, It's removing logged user requirement to do the survey.

This is my: views/vendor/survey/standard.blade.php

`



{{ $survey->name }}

    @if(!$eligible)
    Nós aceitamos apenas
    <strong>{{ $survey->limitPerParticipant() }}
        {{ \Str::plural('entrada', $survey->limitPerParticipant()) }}</strong>
    por participante.
    @endif

    @if($lastEntry)
    Você já enviou as suas respostas <strong>{{ $lastEntry->created_at->diffForHumans() }}</strong>.
    @endif

</div>
@if(!$survey->acceptsGuestEntries() && auth()->guest())
<div class="p-5">
    Porfavor faça o <a href="{{ route('login') }}">login</a> para fazer essa pesquisa.
</div>
@else
@foreach($survey->sections as $section)
@include('survey::sections.single')
@endforeach

@foreach($survey->questions()->withoutSection()->get() as $question)
@include('survey::questions.single')
@endforeach

@if($eligible)
<button class="btn btn-primary">Enviar</button>
@endif
@endif
`

Make form for survey

Hello i made a blade with including the survey but how to make a form to collect the entries and push them in db ?

Guest Submit + Special Parameters ?

Hi . is it possible limit-per-participant with guest submit by passing unique id to survey then the page refresh it's self to setting this ID as hidden input ?

also could we pass special parameter like the name of the participant to survey as " Welcome Firstname Lastname !" ?

Thanks for this project

How to add custom column to Entry model

Hi,
I want to add 2 fields to the Entry model, one to save the fingerprint of the browser, and the other to save the converted time. This way I can identify different Guest users roughly. I have solved the way of generating fingerprints, and adding database fields is not a problem.
My question are, what is the proper way to define custom fields of Entry model? how to save the data of new fields when user submit answers?
or may be i ask wrong question, should i add fields to other model?

Variable inside view

Hello,

From the example views in the type partial I can see that there are two variables $value, $disabled where this are passed throw ?

Here is the code snippet:

@component('survey::questions.base', compact('question'))
    @foreach($question->options as $option)
        <div class="custom-control custom-radio">
            <input type="radio"
                   name="{{ $question->key }}"
                   id="{{ $question->key . '-' . Str::slug($option) }}"
                   value="{{ $option }}"
                   class="custom-control-input"
                    {{ ($value ?? old($question->key)) == $option ? 'checked' : '' }}
                    {{ ($disabled ?? false) ? 'disabled' : '' }}

            >
            <label class="custom-control-label"
                   for="{{ $question->key . '-' . Str::slug($option) }}">{{ $option }}
                @if($includeResults ?? false)
                    <span class="text-success">
                        ({{ number_format((new \MattDaneshvar\Survey\Utilities\Summary($question))->similarAnswersRatio($option) * 100, 2) }}%)
                    </span>
                @endif
            </label>
        </div>
    @endforeach
@endcomponent

Thanks

How to properly extend Survey and Entry?

Hi! I'm not sure it's something to ask here, but since it's also related to the way you built your component, I'll do.

I'd like to extend Survey and Entry models so I can add more methods inside. I added app/Models/Survey/Survey.php and .../Entry.php models extending those in vendors directory. Everything is working fine, however, I need vendor/.../Models/Entry->survey() and vendor/.../Models/Survey->entries() to map my extended classes instead of those inside the vendor directory. The same for the rest of model relationships related methods. I was be able to achieve this by overriding those specific methods in my model, but I feel this is not the right approach. I also googled it and saw another approaches, but I'm still not convinced since they look like workarounds uglier than mine.

What do you think it's the best I can do to handle this?

Thank you in advance.

Example of what I did:

# app/Models/Survey/Survey.php:

namespace App\Models\Survey;

class Survey extends \MattDaneshvar\Survey\Models\Survey
{
    ...
    public function entries()
    {
        return $this->hasMany(Entry::class); // App\Models\Survey\Entry
    }

}

How get the Report?

MANY THANKS FOR AWSOME PACKAGE, I integrated it in my system , but as I see in the base.blade.php there is variable name $report , but this variable not return any things, can u please guide me to generate the report please

Multi Select type does load check boxes it loads text box

$valid = $request->validate([
'options1s' => 'required',
'options2s' => 'required',
'options3s' => 'required',
'options4s' => 'required'
]);

                $survey->questions()->create([
                    'content' => $question,
                    'type' => 'mutliselect',
                    'options' => [$request->options1s, $request->options2s, $request->options3s, $request->options4s]
                ]);

While building the survey form the type "mutliselect" doesn't work as expected

CVE-2020-11022 (Medium) detected in phpunit/php-code-coverage-7.0.14, jquery-3.4.1.min.js

CVE-2020-11022 - Medium Severity Vulnerability

Vulnerable Libraries - phpunit/php-code-coverage-7.0.14, jquery-3.4.1.min.js

phpunit/php-code-coverage-7.0.14

Library that provides collection, processing, and rendering functionality for PHP code coverage information.

Library home page: https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/bb7c9a210c72e4709cdde67f8b7362f672f2225c

Dependency Hierarchy:

  • orchestra/testbench-v3.9.4 (Root Library)
    • orchestra/testbench-core-v3.9.8
      • fzaninotto/faker-v1.9.2
        • phpunit/phpunit-8.5.15
          • phpunit/php-code-coverage-7.0.14 (Vulnerable Library)
jquery-3.4.1.min.js

JavaScript library for DOM operations

Library home page: https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js

Path to vulnerable library: laravel-survey/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/jquery.min.js

Dependency Hierarchy:

  • jquery-3.4.1.min.js (Vulnerable Library)

Vulnerability Details

In jQuery versions greater than or equal to 1.2 and before 3.5.0, passing HTML from untrusted sources - even after sanitizing it - to one of jQuery's DOM manipulation methods (i.e. .html(), .append(), and others) may execute untrusted code. This problem is patched in jQuery 3.5.0.

Publish Date: 2020-04-29

URL: CVE-2020-11022

CVSS 3 Score Details (6.1)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: Required
    • Scope: Changed
  • Impact Metrics:
    • Confidentiality Impact: Low
    • Integrity Impact: Low
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: https://blog.jquery.com/2020/04/10/jquery-3-5-0-released/

Release Date: 2020-04-29

Fix Resolution: jQuery - 3.5.0


Step up your Open Source Security Game with WhiteSource here

How to disabled element ?

Dear Master,
Thank you so much for the solution
i completely integrated with laravel-survey, how I can set the disabled element?

@component('survey::questions.base', compact('question'))
    <input type="number" name="{{ $question->key }}" id="{{ $question->key }}" class="form-control"
           value="{{ old($question->key) }}" {{ ($disabled ?? false) ? 'disabled' : '' }}>
    
    @slot('report')
        @if($includeResults ?? false)
            {{ number_format((new \MattDaneshvar\Survey\Utilities\Summary($question))->average()) }} (Average)
        @endif
    @endslot
@endcompone
```nt


Email the survey

Hi Matt,

Great work on this package. I am just wondering if you know how I could send this survey to a specific email address so they can complete it? and if possible allow an admin to view the answers once they submit.

Thanks

Fails with mariadb

Migrating: 2021_12_18_180211_create_questions_table

...

PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'json null, rules json null, created_at timestamp null, updated_at timestam' at line 1")

It seems this doesn't work with MariaDB, which is fairly common on Linux servers.

No hint path defined for [survey]

Hi.

I get an error 500 on the live app. It works perfectly fine on Valet.

When I check the logs, the message says:

[2023-04-23 02:30:26] production.ERROR: No hint path defined for [survey]. (View: /home/forge/domain/resources/views/admin/surveys/show.blade.php) {"userId":10,"exception":"[object] (Illuminate\View\ViewException(code: 0): No hint path defined for [survey]. (View: /home/forge/domain/resources/views/admin/surveys/show.blade.php) at /home/forge/domain/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php:112)

@include('survey::standard', ['survey' => $survey])

How do you make it to process the survey?

I now know how to make the survey appear o the list, but how do you make the controller to process the survey and add a new entry when the submit button is clicked?

Missing config?

Migrating: 2021_12_18_180211_create_answers_table

Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name ''

Seems there is a missing config/Survey.php? for config('survey.database.tables.answers')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.