coderstape / laravel-6-questionnaire Goto Github PK
View Code? Open in Web Editor NEWThis is the source code for the final project of the Laravel 6 Beginner course
This is the source code for the final project of the Laravel 6 Beginner course
Hi
Thanks for your very good tutorials.
I had a problem with part three of the final project.
Can you help me?
The error will be sent to your attachment.
SQLSTATE[HY000]: General error: 1364 Field 'questionnaire_id' doesn't have a default value (SQL: insert into
surveys (
name,
email,
updated_at,
created_at) values (Vahid, [email protected], 2020-01-17 19:35:12, 2020-01-17 19:35:12))
Routes
Route::get('/questionnaire/create', 'QuestionnaireController@create'); Route::post('/questionnaire', 'QuestionnaireController@store'); Route::get('/questionnaires/{questionnaire}', 'QuestionnaireController@show'); Route::get('/questionnaires/{questionnaire}/questions/create', 'QuestionController@create'); Route::post('/questionnaires/{questionnaire}/questions', 'QuestionController@store'); Route::get('/surveys/{questionnaire}-{slug}', 'SurveyController@show'); Route::post('/surveys/{questionnaire}-{slug}', 'SurveyController@store');
Store Method in SurveyController
public function store(Questionnaire $questionnaire) { $data = request()->validate([ 'responses.*.answer_id' => 'required', 'responses.*.question_id' => 'required', 'survey.name' => 'required', 'survey.email' => 'required|email', ]); $survey = $questionnaire->surveys()->create($data['survey']); $survey->createMany($data['responses']); return "Thank you"; }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.