Laravel Quiz

source: https://github.com/SAIBA0011/laravel-quiz

Description:

Laravel-Quiz functionality

Create a new quiz
Create quiz questions — single & multi Select
show quiz questions
Create quiz question options — Pending..
To be implemented

Finish quiz question options.
Change question position.
Change question option position.
Randomize question order on display page.
Track user attempts per quiz.
Allow user to take quiz.
allow user to complete quiz.
show quiz results on complete.

Installation:

  1. Create a new laravel project:

     
  2. Download the app from https://github.com/SAIBA0011/laravel-quiz. It’s better to donwload in zip file then extract the content in /works/laravel/quiz/ directory. Overwrite the existing files and directories.
  3. Install the laravel component required:

     
  4. Create a new database ‘laravel_quiz’ by phpmyadmin
  5. Use ‘php artisan migrate’ to create the tables.
    NOTE: I got this error when trying to do ‘migrate’
    “teddy@teddy-K43SJ:~/Documents/works/laravel/laravel-quiz$ php artisan migrate
    Migration table created successfully.[Illuminate\Database\QueryException]
    SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error i
    n your SQL syntax; check the manual that corresponds to your MySQL server v
    ersion for the right syntax to use near ‘) on delete cascade’ at line 1 (SQ
    L: alter table quiz_results add constraint quiz_results_user_id_foreign
    foreign key (user_id) references users () on delete cascade)
    [PDOException]
    SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error i
    n your SQL syntax; check the manual that corresponds to your MySQL server v
    ersion for the right syntax to use near ‘) on delete cascade’ at line 1 ”
    SOLUTION: At first, I did like in the articles http://stackoverflow.com/questions/26820788/add-on-delete-cascade-to-existing-column-in-laravel and http://stackoverflow.com/questions/28167329/laravel-migration-remove-ondeletecascade-from-existing-foreign-key on ‘2016_10_24_101046_create_quiz_results_table.php’ in /database/migrations/ directory BUT SOMEHOW IT DIDN’T WORK

    SO I JUST COMMENT THE ‘onDelete’ COMMAND

    THEN THE MIGRATIONS RUN WELL.
  6. generate the new key
  7. Install npm modules and gulp

    BUT SOMEHOW I GOT THIS ERROR ON ‘gulp’

    NO SOLUTION YET:
    I’VE TRIED FROM https://laracasts.com/discuss/channels/elixir/laravel-53-error-on-gulp-execution?page=1

    BUT FAILED AND GOT THIS ERROR

    I ALSO TRIED (DONT DO THIS BECAUSE I BROKE THE ENVIRONMENT BINDING!)

    BECAUSE OF THIS I GOT A HARDTIME AND SPENT MANY ERRORS TO FIX IT (http://stackoverflow.com/questions/37324519/node-sass-does-not-yet-support-your-current-environment-linux-64-bit-with-false) THROUGH THIS:

    BUT THE ERROR STILL PERSIST (ON GULP)! DONT KNOW HOW TO FIX IT!!!
    I READ gulpfile.js IN ‘laravel-quiz’ PROJECT DIFFERENT WITH IN ‘quiz’ PROJECT. THEREFORE ‘laravel-quiz’ PROJECT USE VUE!!!
  8. Test it live (http://localhost:8000)laravel-quiz-homeIT RUN WELL
  9. Errors & Solutions:
    When I want to see the quiz result by submitting the answer (http://localhost:8000/second-quiz/submit), I got this error:
    “ErrorException in QuizResultsController.php line 25:
    Trying to get property of non-object”
    SOLUTION: This is because I didn’t login first. Use http://localhost:8000/home to login/register (I’ve registered with email: ‘advcha@yahoo.com’ and password: ‘satria’) then take the quiz again and answer the above question. Then the result would be showed up like this:laravel-quiz-result
  10. Others samples for online quiz:
    http://practice.cappassessments.com/Nrt/NrtPage.html (Shows time to answer question, can drag up or down the answer options, not only can pick the answer, but also can type the answer). There is a job application in upwork for this kind of online quiz: https://www.upwork.com/jobs/_~01d2316bc1f3c2cb84/.

Leave a Reply

Your email address will not be published. Required fields are marked *