diff --git a/app/Http/Controllers/AnswerController.php b/app/Http/Controllers/AnswerController.php new file mode 100644 index 0000000..ff94eaa --- /dev/null +++ b/app/Http/Controllers/AnswerController.php @@ -0,0 +1,95 @@ +response + ->item($answer, new AnswerTransformer, ['key' => 'answers']); + } + + /** + * Show the form for editing the specified resource. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function edit($id) + { + // + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param int $id + * @return \Illuminate\Http\Response + */ + public function update(Request $request, $id) + { + // + } + + /** + * Remove the specified resource from storage. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function destroy($id) + { + // + } +} diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php new file mode 100644 index 0000000..f4850c9 --- /dev/null +++ b/app/Http/Controllers/CategoryController.php @@ -0,0 +1,95 @@ +response + ->item($category, new CategoryTransformer, ['key' => 'categories']); + } + + /** + * Show the form for editing the specified resource. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function edit($id) + { + // + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param int $id + * @return \Illuminate\Http\Response + */ + public function update(Request $request, $id) + { + // + } + + /** + * Remove the specified resource from storage. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function destroy($id) + { + // + } +} diff --git a/app/Http/Controllers/QuestionAnswerController.php b/app/Http/Controllers/QuestionAnswerController.php new file mode 100644 index 0000000..fe015b0 --- /dev/null +++ b/app/Http/Controllers/QuestionAnswerController.php @@ -0,0 +1,108 @@ +response + // ->item($question, new QuestionTransformer, ['key' => 'questions']); + + $answer = $question->answers()->get(); + + return AnswerResource::collection($answer); + } + + /** + * Show the form for creating a new resource. + * + * @return \Illuminate\Http\Response + */ + public function create() + { + // + } + + /** + * Store a newly created resource in storage. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function store(Request $request) + { + // return $request; + $question = Question::find($request->question_id); + if ($question == null) { + throw new NotFoundHttpException("Question not found."); + + } + $answer = $question->answers()->create($request->all()); + + // return $this->response + // ->item($answer, new AnswerTransformer, ['key' => 'answers']); + return new AnswerResource($answer); + } + + /** + * Display the specified resource. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function show($id) + { + // + } + + /** + * Show the form for editing the specified resource. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function edit($id) + { + // + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param int $id + * @return \Illuminate\Http\Response + */ + public function update(Request $request, $id) + { + // + } + + /** + * Remove the specified resource from storage. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function destroy($id) + { + // + } +} diff --git a/app/Http/Controllers/QuestionController.php b/app/Http/Controllers/QuestionController.php new file mode 100644 index 0000000..d85338e --- /dev/null +++ b/app/Http/Controllers/QuestionController.php @@ -0,0 +1,92 @@ +response + ->item($question, new QuestionTransformer, ['key' => 'questions']); + } + + /** + * Show the form for editing the specified resource. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function edit($id) + { + // + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param int $id + * @return \Illuminate\Http\Response + */ + public function update(Request $request, $id) + { + // + } + + /** + * Remove the specified resource from storage. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function destroy($id) + { + // + } +} diff --git a/app/Http/Controllers/QuestionnaireController.php b/app/Http/Controllers/QuestionnaireController.php new file mode 100644 index 0000000..326575e --- /dev/null +++ b/app/Http/Controllers/QuestionnaireController.php @@ -0,0 +1,97 @@ +response + // ->collection($questionnaires, new QuestionnaireResource, ['key' => 'questionnaires']); + return QuestionnaireResource::collection($questionnaires); + } + + /** + * Show the form for creating a new resource. + * + * @return \Illuminate\Http\Response + */ + public function create() + { + // + } + + /** + * Store a newly created resource in storage. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function store(Request $request) + { + // + } + + /** + * Display the specified resource. + * + * @param \App\Models\Questionnaire $id + * @return \Illuminate\Http\Response + */ + public function show($id) + { + $questionnaire = Questionnaire::findOrFail($id); + + return $this->response + ->item($questionnaire, new QuestionnaireTransformer, ['key' => 'questionnaires']); + } + + /** + * Show the form for editing the specified resource. + * + * @param \App\Models\Questionnaire $id + * @return \Illuminate\Http\Response + */ + public function edit(Questionnaire $id) + { + // + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param \App\Models\Questionnaire $id + * @return \Illuminate\Http\Response + */ + public function update(Request $request, Questionnaire $id) + { + // + } + + /** + * Remove the specified resource from storage. + * + * @param \App\Models\Questionnaire $id + * @return \Illuminate\Http\Response + */ + public function destroy(Questionnaire $id) + { + // + } +} diff --git a/app/Http/Controllers/QuestionnaireSectionController.php b/app/Http/Controllers/QuestionnaireSectionController.php new file mode 100644 index 0000000..f06e237 --- /dev/null +++ b/app/Http/Controllers/QuestionnaireSectionController.php @@ -0,0 +1,96 @@ +sections()->get(); + + // return $this->response + // ->paginator($sections, new SectionTransformer, ['key' => 'sections']); + return SectionResource::collection($sections); + } + + /** + * Show the form for creating a new resource. + * + * @return \Illuminate\Http\Response + */ + public function create() + { + // + } + + /** + * Store a newly created resource in storage. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function store(Request $request) + { + // + } + + /** + * Display the specified resource. + * + * @param \App\Model\Questionnaire $questionnaire + * @return \Illuminate\Http\Response + */ + public function show(Questionnaire $questionnaire, Section $section) + { + // + echo "You've requested section with questionnaire id:" . $id; + } + + /** + * Show the form for editing the specified resource. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function edit($id) + { + // + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param int $id + * @return \Illuminate\Http\Response + */ + public function update(Request $request, $id) + { + // + } + + /** + * Remove the specified resource from storage. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function destroy($id) + { + // + } +} diff --git a/app/Http/Controllers/RespondentController.php b/app/Http/Controllers/RespondentController.php new file mode 100644 index 0000000..4296519 --- /dev/null +++ b/app/Http/Controllers/RespondentController.php @@ -0,0 +1,95 @@ +response + ->item($respondent, new RespondentTransformer, ['key' => 'respondents']); + } + + /** + * Show the form for editing the specified resource. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function edit($id) + { + // + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param int $id + * @return \Illuminate\Http\Response + */ + public function update(Request $request, $id) + { + // + } + + /** + * Remove the specified resource from storage. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function destroy($id) + { + // + } +} diff --git a/app/Http/Controllers/SectionController.php b/app/Http/Controllers/SectionController.php new file mode 100644 index 0000000..186aba8 --- /dev/null +++ b/app/Http/Controllers/SectionController.php @@ -0,0 +1,92 @@ +response + ->item($section, new SectionTransformer, ['key' => 'sections']); + } + + /** + * Show the form for editing the specified resource. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function edit($id) + { + // + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param int $id + * @return \Illuminate\Http\Response + */ + public function update(Request $request, $id) + { + // + } + + /** + * Remove the specified resource from storage. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function destroy($id) + { + // + } +} diff --git a/app/Http/Controllers/SectionQuestionController.php b/app/Http/Controllers/SectionQuestionController.php new file mode 100644 index 0000000..1dc1b00 --- /dev/null +++ b/app/Http/Controllers/SectionQuestionController.php @@ -0,0 +1,96 @@ +questions()->paginate(1); + + return $this->response + ->paginator($question, new QuestionTransformer, ['key' => 'questions']); + + // return QuestionTransformer::collection($questions); + } + + /** + * Show the form for creating a new resource. + * + * @return \Illuminate\Http\Response + */ + public function create() + { + // + } + + /** + * Store a newly created resource in storage. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function store(Request $request) + { + // + } + + /** + * Display the specified resource. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function show($id) + { + // + } + + /** + * Show the form for editing the specified resource. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function edit($id) + { + // + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param int $id + * @return \Illuminate\Http\Response + */ + public function update(Request $request, $id) + { + // + } + + /** + * Remove the specified resource from storage. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function destroy($id) + { + // + } +} diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php new file mode 100644 index 0000000..d7380e8 --- /dev/null +++ b/app/Http/Controllers/UserController.php @@ -0,0 +1,95 @@ +response + ->item($user, new UserTransformer, ['key' => 'users']); + } + + /** + * Show the form for editing the specified resource. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function edit($id) + { + // + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param int $id + * @return \Illuminate\Http\Response + */ + public function update(Request $request, $id) + { + // + } + + /** + * Remove the specified resource from storage. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function destroy($id) + { + // + } +} diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 93bf68b..e5596e6 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -19,6 +19,7 @@ class Kernel extends HttpKernel \App\Http\Middleware\TrimStrings::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, \App\Http\Middleware\TrustProxies::class, + \App\Http\Middleware\ModifyHeadersMiddleware::class, ]; /** diff --git a/app/Http/Middleware/ModifyHeadersMiddleware.php b/app/Http/Middleware/ModifyHeadersMiddleware.php new file mode 100644 index 0000000..7c99981 --- /dev/null +++ b/app/Http/Middleware/ModifyHeadersMiddleware.php @@ -0,0 +1,23 @@ +header('Access-Control-Allow-Origin', '*'); + $response->header('Access-Control-Allow-Headers', 'Origin, Content-Type'); + return $response; + } +} diff --git a/app/Http/Resources/AnswerResource.php b/app/Http/Resources/AnswerResource.php new file mode 100644 index 0000000..87bb865 --- /dev/null +++ b/app/Http/Resources/AnswerResource.php @@ -0,0 +1,30 @@ + $this->id, + 'choice' => $this->questionchoice, + 'text' => $this->text, + 'links' => [ + 'self' => route('answers.show', ['answers' => $this->id]), + 'relatedTo' => [ + 'question' => route('questions.show', ['questions' => $this->question_id]), + 'respondent' => route('respondents.show', ['respondents' => $this->respondent_id]) + ] + ] + ]; + } +} diff --git a/app/Http/Resources/CategoryResource.php b/app/Http/Resources/CategoryResource.php new file mode 100644 index 0000000..48b9157 --- /dev/null +++ b/app/Http/Resources/CategoryResource.php @@ -0,0 +1,27 @@ + $this->id, + 'name' => $this->name, + 'code' => $this->code, + 'links' => [ + 'self' => route('categories.show', ['categories' => $this->id]) + ] + ]; + } +} diff --git a/app/Http/Resources/QuestionResource.php b/app/Http/Resources/QuestionResource.php new file mode 100644 index 0000000..99cd1d7 --- /dev/null +++ b/app/Http/Resources/QuestionResource.php @@ -0,0 +1,29 @@ + $this->id, + 'text' => $this->text, + 'number' => $this->number, + 'description' => $this->description, + 'section' => new SectionResource($this->section), + 'links' => [ + 'self' => route('questions.show', ['questions' => $this->id]) + ] + ]; + } +} diff --git a/app/Http/Resources/QuestionchoiceResource.php b/app/Http/Resources/QuestionchoiceResource.php new file mode 100644 index 0000000..0ed8895 --- /dev/null +++ b/app/Http/Resources/QuestionchoiceResource.php @@ -0,0 +1,28 @@ + $this->id, + 'number' => $this->number, + 'text' => $this->text, + 'fillable' => $this->fillable, + 'description' => $this->description, + 'links' => [ + 'relatedTo' => route('questions.show', ['questions' => $this->question_id]) + ] + ]; + } +} diff --git a/app/Http/Resources/QuestionnaireResource.php b/app/Http/Resources/QuestionnaireResource.php new file mode 100644 index 0000000..1d92892 --- /dev/null +++ b/app/Http/Resources/QuestionnaireResource.php @@ -0,0 +1,28 @@ + $this->id, + 'category' => new CategoryResource($this->category), + 'title' => $this->title, + 'description' => $this->description, + 'links' => [ + 'self' => route('questionnaires.show', ['questionnaires' => $this->id]) + ] + ]; + } +} diff --git a/app/Http/Resources/RespondentResource.php b/app/Http/Resources/RespondentResource.php new file mode 100644 index 0000000..78390aa --- /dev/null +++ b/app/Http/Resources/RespondentResource.php @@ -0,0 +1,27 @@ + $this->id, + 'name' => $this->name, + 'occupation' => $this->occupation, + 'gender' => $this->gender, + 'links' => [ + 'self' => route('respondents.show', ['respondents' => $this->id]) + ] + ]; + } +} diff --git a/app/Http/Resources/SectionResource.php b/app/Http/Resources/SectionResource.php new file mode 100644 index 0000000..c0512fd --- /dev/null +++ b/app/Http/Resources/SectionResource.php @@ -0,0 +1,27 @@ + $this->id, + 'title' => $this->title, + 'description' => $this->description, + 'links' => [ + 'self' => route('sections.show', ['sections' => $this->id]) + ] + ]; + } +} diff --git a/app/Http/Resources/UserResource.php b/app/Http/Resources/UserResource.php new file mode 100644 index 0000000..a61fe78 --- /dev/null +++ b/app/Http/Resources/UserResource.php @@ -0,0 +1,25 @@ + $this->id, + 'username' => $this->username, + 'name' => $this->name, + 'email' => $this->email + ]; + } +} diff --git a/app/Models/Answer.php b/app/Models/Answer.php new file mode 100644 index 0000000..cadbb50 --- /dev/null +++ b/app/Models/Answer.php @@ -0,0 +1,45 @@ +belongsTo(Question::class); + } + + public function questionchoice() + { + return $this->belongsTo(Questionchoice::class); + } + + public function respondent() + { + return $this->belongsTo(Respondent::class); + } +} diff --git a/app/Models/Category.php b/app/Models/Category.php new file mode 100644 index 0000000..0349be8 --- /dev/null +++ b/app/Models/Category.php @@ -0,0 +1,27 @@ +belongsTo(User::class, 'creator_id'); + } +} diff --git a/app/Models/Question.php b/app/Models/Question.php new file mode 100644 index 0000000..7804b40 --- /dev/null +++ b/app/Models/Question.php @@ -0,0 +1,42 @@ +belongsTo(Section::class); + } + + public function choices() + { + return $this->hasMany(Questionchoice::class); + } + + public function creator() + { + return $this->belongsTo(User::class); + } + + public function answers() + { + return $this->hasMany(Answer::class); + } +} diff --git a/app/Models/Questionchoice.php b/app/Models/Questionchoice.php new file mode 100644 index 0000000..4e10a08 --- /dev/null +++ b/app/Models/Questionchoice.php @@ -0,0 +1,27 @@ +belongsTo(Question::class); + } +} diff --git a/app/Models/Questionnaire.php b/app/Models/Questionnaire.php new file mode 100644 index 0000000..120f57a --- /dev/null +++ b/app/Models/Questionnaire.php @@ -0,0 +1,45 @@ +hasMany(Section::class); + } + + public function questions() + { + return $this->hasManyThrough(Question::class, Section::class); + } + + public function category() + { + return $this->belongsTo(Category::class); + } + + public function creator() + { + return $this->belongsTo(User::class); + } +} diff --git a/app/Models/Respondent.php b/app/Models/Respondent.php new file mode 100644 index 0000000..801d9e3 --- /dev/null +++ b/app/Models/Respondent.php @@ -0,0 +1,27 @@ +belongsTo(Category::class); + } +} diff --git a/app/Models/Section.php b/app/Models/Section.php new file mode 100644 index 0000000..d308648 --- /dev/null +++ b/app/Models/Section.php @@ -0,0 +1,42 @@ +belongsTo(Questionnaire::class); + } + + public function questions() + { + return $this->hasMany(Question::class); + } + + public function choices() + { + return $this->hasManyThrough(Choice::class, Question::class); + } + + public function creator() + { + return $this->belongsTo(User::class); + } +} diff --git a/app/Models/User.php b/app/Models/User.php index bfd96a6..8919758 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -1,14 +1,30 @@ app['Dingo\Api\Transformer\Factory']->setAdapter(function ($app) { + $baseUrl = 'http://api.questionnaire.dev/v1'; + $manager = new \League\Fractal\Manager; + $manager->setSerializer(new \League\Fractal\Serializer\JsonApiSerializer($baseUrl)); + + + return new \Dingo\Api\Transformer\Adapter\Fractal($manager, 'include', ','); + }); + } +} diff --git a/app/Transformers/AnswerTransformer.php b/app/Transformers/AnswerTransformer.php new file mode 100644 index 0000000..9f92a4e --- /dev/null +++ b/app/Transformers/AnswerTransformer.php @@ -0,0 +1,30 @@ + $model->id, + 'text' => $model->text, + 'question' => new QuestionResource($model->question), + 'respondent' => new RespondentResource($model->respondent), + 'choice' => new QuestionchoiceResource($model->questionchoice), + 'createdAt' => $model->created_at->toIso8601String(), + 'updatedAt' => $model->updated_at->toIso8601String() + ]; + } +} diff --git a/app/Transformers/CategoryTransformer.php b/app/Transformers/CategoryTransformer.php new file mode 100644 index 0000000..494d9ac --- /dev/null +++ b/app/Transformers/CategoryTransformer.php @@ -0,0 +1,29 @@ + $model->id, + 'name' => $model->name, + 'code' => $model->code, + 'createdAt' => $model->created_at->toIso8601String(), + 'updatedAt' => $model->updated_at->toIso8601String(), + 'creator' => new UserResource($model->creator), + 'links' => [ + 'relatedTo' => route('categories.index') + ] + ]; + } +} diff --git a/app/Transformers/QuestionTransformer.php b/app/Transformers/QuestionTransformer.php new file mode 100644 index 0000000..3a21aea --- /dev/null +++ b/app/Transformers/QuestionTransformer.php @@ -0,0 +1,35 @@ + $model->created_at->toIso8601String(), + 'updatedAt' => $model->updated_at->toIso8601String(), + 'id' => $model->id, + 'text' => $model->text, + 'description' => $model->description, + 'section' => new SectionResource($model->section), + 'number' => $model->number, + 'expectedLength' => $model->expected_length, + 'questionType' => $model->question_type, + 'choices' => $model->choices, + 'creator' => new UserResource($model->creator), + 'links' => [ + 'relatedTo' => route('questions.index') + ] + ]; + } +} diff --git a/app/Transformers/QuestionchoiceTransformer.php b/app/Transformers/QuestionchoiceTransformer.php new file mode 100644 index 0000000..af6e264 --- /dev/null +++ b/app/Transformers/QuestionchoiceTransformer.php @@ -0,0 +1,24 @@ + $model->id, + 'number' => $model->number, + 'text' => $model->text, + 'fillable' => $model->fillable, + 'description' => $model->description + ]; + } +} diff --git a/app/Transformers/QuestionnaireTransformer.php b/app/Transformers/QuestionnaireTransformer.php new file mode 100644 index 0000000..e54b014 --- /dev/null +++ b/app/Transformers/QuestionnaireTransformer.php @@ -0,0 +1,38 @@ + $model->created_at->toIso8601String(), + 'updatedAt' => $model->updated_at->toIso8601String(), + 'id' => $model->id, + 'category' => new CategoryResource($model->category), + 'title' => $model->title, + 'description' => $model->description, + 'releasedAt' => $model->released_at, + 'closedAt' => $model->closed_at, + 'reviewedAt' => $model->reviewed_at, + 'sections' => SectionResource::collection($model->sections, ['key' => 'sections']), + 'creator' => $model->creator, + 'links' => [ + 'relatedTo' => route('questionnaires.index') + ] + ]; + } +} diff --git a/app/Transformers/RespondentTransformer.php b/app/Transformers/RespondentTransformer.php new file mode 100644 index 0000000..c760b41 --- /dev/null +++ b/app/Transformers/RespondentTransformer.php @@ -0,0 +1,30 @@ + $model->id, + 'name' => $model->name, + 'occupation' => $model->occupation, + 'gender' => $model->gender, + 'birthdate' => $model->birthdate, + 'email' => $model->email, + 'handphone' => $model->handphone, + 'category' => new CategoryResource($model->category), + 'createdAt' => $model->created_at->toIso8601String(), + 'updatedAt' => $model->updated_at->toIso8601String() + ]; + } +} diff --git a/app/Transformers/SectionTransformer.php b/app/Transformers/SectionTransformer.php new file mode 100644 index 0000000..f9881f9 --- /dev/null +++ b/app/Transformers/SectionTransformer.php @@ -0,0 +1,33 @@ + $model->id, + 'title' => $model->title, + 'description' => $model->description, + 'questionnaire' => new QuestionnaireResource($model->questionnaire), + 'questions' => QuestionResource::collection($model->questions()->orderBy('number')->get()), + 'createdAt' => $model->created_at->toIso8601String(), + 'updatedAt' => $model->updated_at->toIso8601String(), + 'creator' => new UserResource($model->creator), + 'links' => [ + 'relatedTo' => route('sections.index') + ] + ]; + } +} diff --git a/app/Transformers/UserTransformer.php b/app/Transformers/UserTransformer.php new file mode 100644 index 0000000..5f41783 --- /dev/null +++ b/app/Transformers/UserTransformer.php @@ -0,0 +1,25 @@ + $model->created_at->toIso8601String(), + 'updatedAt' => $model->updated_at->toIso8601String(), + 'id' => $model->id, + 'username' => $model->username, + 'name' => $model->name, + 'email' => $model->email + ]; + } +} diff --git a/config/api.php b/config/api.php new file mode 100644 index 0000000..c305be8 --- /dev/null +++ b/config/api.php @@ -0,0 +1,233 @@ + env('API_STANDARDS_TREE', 'x'), + + /* + |-------------------------------------------------------------------------- + | API Subtype + |-------------------------------------------------------------------------- + | + | Your subtype will follow the standards tree you use when used in the + | "Accept" header to negotiate the content type and version. + | + | For example: Accept: application/x.SUBTYPE.v1+json + | + */ + + 'subtype' => env('API_SUBTYPE', ''), + + /* + |-------------------------------------------------------------------------- + | Default API Version + |-------------------------------------------------------------------------- + | + | This is the default version when strict mode is disabled and your API + | is accessed via a web browser. It's also used as the default version + | when generating your APIs documentation. + | + */ + + 'version' => env('API_VERSION', 'v1'), + + /* + |-------------------------------------------------------------------------- + | Default API Prefix + |-------------------------------------------------------------------------- + | + | A default prefix to use for your API routes so you don't have to + | specify it for each group. + | + */ + + 'prefix' => env('API_PREFIX', "v1"), + + /* + |-------------------------------------------------------------------------- + | Default API Domain + |-------------------------------------------------------------------------- + | + | A default domain to use for your API routes so you don't have to + | specify it for each group. + | + */ + + 'domain' => env('API_DOMAIN', null), + + /* + |-------------------------------------------------------------------------- + | Name + |-------------------------------------------------------------------------- + | + | When documenting your API using the API Blueprint syntax you can + | configure a default name to avoid having to manually specify + | one when using the command. + | + */ + + 'name' => env('API_NAME', null), + + /* + |-------------------------------------------------------------------------- + | Conditional Requests + |-------------------------------------------------------------------------- + | + | Globally enable conditional requests so that an ETag header is added to + | any successful response. Subsequent requests will perform a check and + | will return a 304 Not Modified. This can also be enabled or disabled + | on certain groups or routes. + | + */ + + 'conditionalRequest' => env('API_CONDITIONAL_REQUEST', true), + + /* + |-------------------------------------------------------------------------- + | Strict Mode + |-------------------------------------------------------------------------- + | + | Enabling strict mode will require clients to send a valid Accept header + | with every request. This also voids the default API version, meaning + | your API will not be browsable via a web browser. + | + */ + + 'strict' => env('API_STRICT', false), + + /* + |-------------------------------------------------------------------------- + | Debug Mode + |-------------------------------------------------------------------------- + | + | Enabling debug mode will result in error responses caused by thrown + | exceptions to have a "debug" key that will be populated with + | more detailed information on the exception. + | + */ + + 'debug' => env('API_DEBUG', false), + + /* + |-------------------------------------------------------------------------- + | Generic Error Format + |-------------------------------------------------------------------------- + | + | When some HTTP exceptions are not caught and dealt with the API will + | generate a generic error response in the format provided. Any + | keys that aren't replaced with corresponding values will be + | removed from the final response. + | + */ + + 'errorFormat' => [ + 'message' => ':message', + 'errors' => ':errors', + 'code' => ':code', + 'status_code' => ':status_code', + 'debug' => ':debug', + ], + + /* + |-------------------------------------------------------------------------- + | API Middleware + |-------------------------------------------------------------------------- + | + | Middleware that will be applied globally to all API requests. + | + */ + + 'middleware' => [ + + ], + + /* + |-------------------------------------------------------------------------- + | Authentication Providers + |-------------------------------------------------------------------------- + | + | The authentication providers that should be used when attempting to + | authenticate an incoming API request. + | + */ + + 'auth' => [ + + ], + + /* + |-------------------------------------------------------------------------- + | Throttling / Rate Limiting + |-------------------------------------------------------------------------- + | + | Consumers of your API can be limited to the amount of requests they can + | make. You can create your own throttles or simply change the default + | throttles. + | + */ + + 'throttling' => [ + + ], + + /* + |-------------------------------------------------------------------------- + | Response Transformer + |-------------------------------------------------------------------------- + | + | Responses can be transformed so that they are easier to format. By + | default a Fractal transformer will be used to transform any + | responses prior to formatting. You can easily replace + | this with your own transformer. + | + */ + + 'transformer' => env('API_TRANSFORMER', Dingo\Api\Transformer\Adapter\Fractal::class), + + /* + |-------------------------------------------------------------------------- + | Response Formats + |-------------------------------------------------------------------------- + | + | Responses can be returned in multiple formats by registering different + | response formatters. You can also customize an existing response + | formatter with a number of options to configure its output. + | + */ + + 'defaultFormat' => env('API_DEFAULT_FORMAT', 'json'), + + 'formats' => [ + + 'json' => Dingo\Api\Http\Response\Format\Json::class, + + ], + + 'formatsOptions' => [ + + 'json' => [ + 'pretty_print' => env('API_JSON_FORMAT_PRETTY_PRINT_ENABLED', false), + 'indent_style' => env('API_JSON_FORMAT_INDENT_STYLE', 'space'), + 'indent_size' => env('API_JSON_FORMAT_INDENT_SIZE', 2), + ], + + ], + +]; diff --git a/config/app.php b/config/app.php index 0e4ebed..f5a1e06 100644 --- a/config/app.php +++ b/config/app.php @@ -177,6 +177,8 @@ return [ App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, + App\Providers\JSONApiServiceProvider::class, + ], /* diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 689cbee..d4764b1 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -15,11 +15,19 @@ class CreateUsersTable extends Migration { Schema::create('users', function (Blueprint $table) { $table->increments('id'); - $table->string('name'); - $table->string('email')->unique(); - $table->string('password'); - $table->rememberToken(); + + $table->string('username', 60); + + $table->string('name', 100); + + $table->string('email', 100) + ->unique(); + + $table->string('password', 41); + $table->timestamps(); + + $table->softDeletes(); }); } diff --git a/database/migrations/2017_12_13_030915_create_categories_table.php b/database/migrations/2017_12_13_030915_create_categories_table.php new file mode 100644 index 0000000..c60e3a4 --- /dev/null +++ b/database/migrations/2017_12_13_030915_create_categories_table.php @@ -0,0 +1,48 @@ +increments('id'); + + $table->string('code', 10); + + $table->string('name', 100); + + $table->integer('creator_id') + ->unsigned() + ->nullable(); + + $table->timestamps(); + + $table->softDeletes(); + + + $table->foreign('creator_id') + ->references('id')->on('users') + ->onDeletes('restrict') + ->onUpdate('cascade'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('categories'); + } +} diff --git a/database/migrations/2017_12_14_023002_create_questionnaires_table.php b/database/migrations/2017_12_14_023002_create_questionnaires_table.php new file mode 100644 index 0000000..f85f16f --- /dev/null +++ b/database/migrations/2017_12_14_023002_create_questionnaires_table.php @@ -0,0 +1,75 @@ +increments('id'); + + $table->string('title', 100); + + $table->text('description') + ->nullable(); + + $table->integer('creator_id') + ->unsigned(); + + $table->integer('category_id') + ->unsigned() + ->nullable(); + + $table->integer('reviewer_id') + ->unsigned() + ->nullable(); + + $table->timestamps(); + + $table->timestamp('released_at') + ->nullable(); + + $table->timestamp('closed_at') + ->nullable(); + + $table->timestamp('reviewed_at') + ->nullable(); + + $table->softDeletes(); + + + $table->foreign('creator_id') + ->references('id')->on('users') + ->onDelete('restrict') + ->onUpdate('cascade'); + + $table->foreign('category_id') + ->references('id')->on('categories') + ->onDelete('restrict') + ->onUpdate('cascade'); + + $table->foreign('reviewer_id') + ->references('id')->on('users') + ->onDelete('restrict') + ->onUpdate('cascade'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('questionnaires'); + } +} diff --git a/database/migrations/2017_12_14_072624_create_sections_table.php b/database/migrations/2017_12_14_072624_create_sections_table.php new file mode 100644 index 0000000..a12947c --- /dev/null +++ b/database/migrations/2017_12_14_072624_create_sections_table.php @@ -0,0 +1,56 @@ +increments('id'); + + $table->integer('questionnaire_id') + ->unsigned(); + + $table->integer('creator_id') + ->unsigned(); + + $table->string('title', 100); + + $table->text('description') + ->nullable(); + + $table->timestamps(); + + $table->softDeletes(); + + + $table->foreign('questionnaire_id') + ->references('id')->on('questionnaires') + ->onDelete('restrict') + ->onUpdate('cascade'); + + $table->foreign('creator_id') + ->references('id')->on('users') + ->onDelete('restrict') + ->onUpdate('cascade'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('sections'); + } +} diff --git a/database/migrations/2017_12_14_072642_create_questions_table.php b/database/migrations/2017_12_14_072642_create_questions_table.php new file mode 100644 index 0000000..0136855 --- /dev/null +++ b/database/migrations/2017_12_14_072642_create_questions_table.php @@ -0,0 +1,70 @@ +increments('id'); + + $table->integer('section_id') + ->unsigned(); + + $table->integer('creator_id') + ->unsigned(); + + $table->integer('number'); + + $table->string('text', 300); + + $table->text('description') + ->nullable(); + + $table->integer('expected_length') + ->nullable(); + + $table->enum('question_type', [ + 'text', + 'choice', + 'multichoice', + 'numeric', + 'bool' + ]) + ->default('text'); + + $table->timestamps(); + + $table->softDeletes(); + + + $table->foreign('section_id') + ->references('id')->on('sections') + ->onDelete('restrict') + ->onUpdate('cascade'); + + $table->foreign('creator_id') + ->references('id')->on('users') + ->onDelete('restrict') + ->onUpdate('cascade'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('questions'); + } +} diff --git a/database/migrations/2017_12_14_072728_create_questionchoices_table.php b/database/migrations/2017_12_14_072728_create_questionchoices_table.php new file mode 100644 index 0000000..79bab20 --- /dev/null +++ b/database/migrations/2017_12_14_072728_create_questionchoices_table.php @@ -0,0 +1,62 @@ +increments('id'); + + $table->integer('question_id') + ->unsigned(); + + $table->integer('creator_id') + ->unsigned() + ->nullable(); + + $table->integer('number'); + + $table->string('text', 300); + + $table->text('description') + ->nullable(); + + $table->boolean('fillable') + ->nullable(); + + $table->timestamps(); + + $table->softDeletes(); + + + $table->foreign('question_id') + ->references('id')->on('questions') + ->onDelete('restrict') + ->onUpdate('cascade'); + + $table->foreign('creator_id') + ->references('id')->on('users') + ->onDelete('restrict') + ->onUpdate('cascade'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('questionchoices'); + } +} diff --git a/database/migrations/2017_12_15_040117_create_respondents_table.php b/database/migrations/2017_12_15_040117_create_respondents_table.php new file mode 100644 index 0000000..75723fe --- /dev/null +++ b/database/migrations/2017_12_15_040117_create_respondents_table.php @@ -0,0 +1,57 @@ +increments('id'); + + $table->string('name', 100); + + $table->string('handphone', 100); + + $table->string('email', 100) + ->unique(); + + $table->enum('gender', ['m', 'f']); + + $table->string('occupation', 100); + + $table->date('birthdate'); + + $table->integer('category_id') + ->unsigned() + ->nullable(); + + $table->timestamps(); + + $table->softDeletes(); + + + $table->foreign('category_id') + ->references('id')->on('categories') + ->onDeletes('restrict') + ->onUpdate('cascade'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('respondents'); + } +} diff --git a/database/migrations/2017_12_16_033408_create_answers_table.php b/database/migrations/2017_12_16_033408_create_answers_table.php new file mode 100644 index 0000000..92d8fcf --- /dev/null +++ b/database/migrations/2017_12_16_033408_create_answers_table.php @@ -0,0 +1,64 @@ +increments('id'); + + $table->integer('respondent_id') + ->unsigned() + ->nullable(); + + $table->integer('question_id') + ->unsigned() + ->nullable(); + + $table->text('text'); + + $table->integer('questionchoice_id') + ->unsigned() + ->nullable(); + + $table->timestamps(); + + $table->softDeletes(); + + + $table->foreign('respondent_id') + ->references('id')->on('respondents') + ->onDeletes('restrict') + ->onUpdate('cascade'); + + $table->foreign('question_id') + ->references('id')->on('questions') + ->onDeletes('restrict') + ->onUpdate('cascade'); + + $table->foreign('questionchoice_id') + ->references('id')->on('questionchoices') + ->onDeletes('restrict') + ->onUpdate('cascade'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('answers'); + } +} diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index e119db6..13ea654 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -11,6 +11,8 @@ class DatabaseSeeder extends Seeder */ public function run() { - // $this->call(UsersTableSeeder::class); + $this->call(UsersTableSeeder::class); + $this->call(QuestionnairesSeeder::class); + $this->call(RespondentSeeder::class); } } diff --git a/database/seeds/QuestionnairesSeeder.php b/database/seeds/QuestionnairesSeeder.php new file mode 100644 index 0000000..799d1d6 --- /dev/null +++ b/database/seeds/QuestionnairesSeeder.php @@ -0,0 +1,2128 @@ + '123', + 'name' => 'Mahasiswa', + 'creator_id' => '1' + ]); + foreach ($this->prepareData() as $q) { + $questionnaire = Questionnaire::create([ + 'title' => $q['title'], + 'creator_id' => $q['creator_id'], + 'reviewer_id' => $q['reviewer_id'], + 'category_id' => $q['category_id'], + ]); + foreach ($q['sections'] as $s) { + $section = $questionnaire->sections()->create([ + 'title' => $s['title'], + 'creator_id' => $s['creator_id'] + ]); + foreach ($s['questions'] as $qn) { + $question = $section->questions()->create([ + 'number' => $qn['number'], + 'text' => $qn['text'], + 'question_type' => $qn['question_type'], + 'creator_id' => $qn['creator_id'] + ]); + if (!empty($qn['choices'])) { + foreach ($qn['choices'] as $c) { + $choice = $question->choices()->create($c); + } + } + } + } + } + } + + public function prepareData() + { + return [[ + 'title' => 'Kuesioner Tracer Study STIE BISMA dan AKSEMA Lepisi', + 'creator_id' => '1', + 'reviewer_id' => '1', + 'category_id' => '1', + 'sections' => [ + [ + 'title' => 'Data Pribadi', + 'creator_id' => '1', + 'questions' => [ + [ + 'number' => '1', + 'text' => 'Nama Lengkap', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '2', + 'text' => 'Jenis Kelamin', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Laki-laki' + ], + [ + 'number' => '2', + 'text' => 'Perempuan' + ] + ] + ], + [ + 'number' => '3', + 'text' => 'Asal SMU', + 'description' => 'Alamat lengkap SMU', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '4', + 'text' => 'Tempat Tanggal Lahir', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '5', + 'text' => 'Alamat Kantor', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '6', + 'text' => 'No. Telp. Kantor', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '7', + 'text' => 'Kode Pos Kantor', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '8', + 'text' => 'Alamat Rumah', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '9', + 'text' => 'No. Telp. Rumah', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '10', + 'text' => 'Kode Pos Rumah', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '11', + 'text' => 'No. HP (mobile phone)', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '12', + 'text' => 'Alamat email', + 'question_type' => 'text', + 'creator_id' => '1' + ] + ] + ], + [ + 'title' => 'Riwayat Pendidikan', + 'creator_id' => '1', + 'questions' => [ + [ + 'number' => '1', + 'text' => 'Tahun Masuk', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '2', + 'text' => 'Bulan dan Tahun Wisuda', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '3', + 'text' => 'Perguruan Tinggi', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'STIE BISMA Lepisi' + ], + [ + 'number' => '2', + 'text' => 'Aksema Lepisi' + ] + ] + ], + [ + 'number' => '4', + 'text' => 'Program Studi', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Manajemen' + ], + [ + 'number' => '2', + 'text' => 'Akuntansi' + ], + [ + 'number' => '3', + 'text' => 'Manajemen Administrasi Akuntansi' + ], + [ + 'number' => '4', + 'text' => 'Sekretari' + ] + ] + ], + [ + 'number' => '5', + 'text' => 'Pada saat masuk Perguruan Tinggi Lepisi, Prodi yang Saudara pilih tersebut merupakan pilihan ke', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Satu' + ], + [ + 'number' => '2', + 'text' => 'Dua' + ], + [ + 'number' => '3', + 'text' => 'Tiga' + ] + ] + ], + [ + 'number' => '6', + 'text' => 'Apakah saudara berorganisasi ketika masih mahasiswa', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Ya' + ], + [ + 'number' => '2', + 'text' => 'Tidak' + ] + ] + ], + [ + 'number' => '7', + 'text' => 'Jika pertanyaan sebelumnya menjawab tidak, mengapa', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sibuk' + ], + [ + 'number' => '2', + 'text' => 'Tidak berminat' + ], + [ + 'number' => '3', + 'text' => 'Tidak sempat' + ], + [ + 'number' => '4', + 'text' => 'Tidak cocok dengan organisasi yang ada' + ], + [ + 'number' => '5', + 'text' => 'Lainnya, sebutkan', + 'fillable' => true + ], + ] + ], + [ + 'number' => '8', + 'text' => 'Setelah lulus Sarjana dari PT Lepisi, apakah Saudara bersekolah lagi', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Ya' + ], + [ + 'number' => '2', + 'text' => 'Tidak', + 'description' => 'langsung ke pertanyaan 20' + ] + ] + ], + [ + 'number' => '9', + 'text' => 'Nama universitas 1', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '10', + 'text' => 'Kota/negara universitas 1', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '11', + 'text' => 'Fakultas/jurusan/prodi universitas 1', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '12', + 'text' => 'Jenjang pendidikan universitas 1', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '13', + 'text' => 'Tahun masuk/lulus universitas 1', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '14', + 'text' => 'Nama universitas 2', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '15', + 'text' => 'Kota/negara universitas 2', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '16', + 'text' => 'Fakultas/jurusan/prodi universitas 2', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '17', + 'text' => 'Jenjang pendidikan universitas 2', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '18', + 'text' => 'Tahun masuk/lulus universitas 2', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '19', + 'text' => 'Apa alasan utama Saudara bersekolah lagi', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Mengisi kekosongan menganggur' + ], + [ + 'number' => '2', + 'text' => 'Perlu untuk bekerja' + ], + [ + 'number' => '3', + 'text' => 'Merasa ilmu yang dimiliki masih kurang' + ], + [ + 'number' => '4', + 'text' => 'Ada kesempatan' + ], + [ + 'number' => '5', + 'text' => 'Sebagai syarat dalam pekerjaan' + ], + [ + 'number' => '6', + 'text' => 'Kurang yakin bila hanya di bidang ini saja' + ], + [ + 'number' => '7', + 'text' => 'Lainnya, sebutkan', + 'fillable' => true + ] + ] + ], + [ + 'number' => '20', + 'text' => 'Pada saat baru lulus, sebenarnya di mana Saudara ingin bekerja', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Pemerintah (pusat/departemen)' + ], + [ + 'number' => '2', + 'text' => 'Pemerintah (daerah)' + ], + [ + 'number' => '3', + 'text' => 'Pemerintah (BUMN, BHMN)' + ], + [ + 'number' => '4', + 'text' => 'Swasta (jasa)' + ], + [ + 'number' => '5', + 'text' => 'Swasta (manufaktur)' + ], + [ + 'number' => '6', + 'text' => 'Wiraswasta' + ], + [ + 'number' => '7', + 'text' => 'Lainnya, sebutkan', + 'fillable' => true + ] + ] + ], + [ + 'number' => '21', + 'text' => 'Pada saat baru lulus, apakah Saudara bersedia bekerja/ditempatkan di daerah', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Ya' + ], + [ + 'number' => '2', + 'text' => 'Tidak' + ] + ] + ], + [ + 'number' => '22', + 'text' => 'Pada saat baru lulus, apakah Saudara mengetahui cara/prosedur melamar pekerjaan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Ya' + ], + [ + 'number' => '2', + 'text' => 'Tidak' + ] + ] + ], + [ + 'number' => '23', + 'text' => 'Menurut saudara, kapan seharusnya cara/prosedur melamar pekerjaan harus mulai diketahui', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sejak tahun pertama perkuliahan' + ], + [ + 'number' => '2', + 'text' => 'Di tahun kedua perkuliahan' + ], + [ + 'number' => '3', + 'text' => 'Di tahun ketiga perkuliahan' + ], + [ + 'number' => '4', + 'text' => 'Di tahun akhir perkuliahan' + ], + [ + 'number' => '5', + 'text' => 'Setelah lulus' + ] + ] + ], + [ + 'number' => '24', + 'text' => 'Pada saat baru lulus, apakah Saudara mengetahui cara membuat CV untuk melamar pekerjaan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Ya' + ], + [ + 'number' => '2', + 'text' => 'Tidak' + ] + ] + ], + [ + 'number' => '25', + 'text' => 'Menurut saudara, kapan seharusnya cara membuat CV harus mulai diketahui', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sejak tahun pertama perkuliahan' + ], + [ + 'number' => '2', + 'text' => 'Di tahun kedua perkuliahan' + ], + [ + 'number' => '3', + 'text' => 'Di tahun ketiga perkuliahan' + ], + [ + 'number' => '4', + 'text' => 'Di tahun akhir perkuliahan' + ], + [ + 'number' => '5', + 'text' => 'Setelah lulus' + ] + ] + ], + [ + 'number' => '26', + 'text' => 'Berapa IPK terakhir Saudara', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => '<2,00' + ], + [ + 'number' => '2', + 'text' => '2,10 - 2,90' + ], + [ + 'number' => '3', + 'text' => '3,00 - 3,49' + ], + [ + 'number' => '4', + 'text' => '3,50 - 4,00' + ] + ] + ], + [ + 'number' => '27', + 'text' => 'Setelah lulus, apakah Saudara sudah/pernah bekerja', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Ya' + ], + [ + 'number' => '2', + 'text' => 'Tidak, alasan', + 'description' => 'Langsung ke seksi 5', + 'fillable' => true + ] + ] + ] + ] + ], + [ + 'title' => 'Riwayat Pekerjaan', + 'creator_id' => '1', + 'questions' => [ + [ + 'number' => '1', + 'text' => 'Nama tempat bekerja', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '2', + 'text' => 'Jenis instansi/bidang usaha/industri', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Pemerintah (pusat/departemen)' + ], + [ + 'number' => '2', + 'text' => 'Pemerintah (daerah)' + ], + [ + 'number' => '3', + 'text' => 'Pemerintah (BUMN, BHMN)' + ], + [ + 'number' => '4', + 'text' => 'Swasta (jasa)' + ], + [ + 'number' => '5', + 'text' => 'Swasta (manufaktur)' + ], + [ + 'number' => '6', + 'text' => 'Wiraswasta' + ], + [ + 'number' => '7', + 'text' => 'Lainnya, sebutkan', + 'fillable' => true + ] + ] + ], + [ + 'number' => '3', + 'text' => 'Jabatan/posisi dalam pekerjaan', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '4', + 'text' => 'Bulan dan tahun mulai bekerja', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '5', + 'text' => 'Bulan dan tahun berhenti bekerja', + 'description' => 'Jika Saudara masih bekerja, tidak perlu diisi', + 'question_type' => 'text', + 'creator_id' => '1', + ], + [ + 'number' => '6', + 'text' => 'Bagaimana proses Saudara mendapatkan pekerjaan ini', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'aktif (mencari sendiri)' + ], + [ + 'number' => '2', + 'text' => 'pasif (ditawari pekerjaan)' + ] + ] + ], + [ + 'number' => '7', + 'text' => 'Dari mana Saudara mengetahui atau mendapatkan informasi mengenai adanya pekerjaan ini', + 'question_type' => 'multichoice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Iklan' + ], + [ + 'number' => '2', + 'text' => 'Internet' + ], + [ + 'number' => '3', + 'text' => 'Pengumuman di kampus' + ], + [ + 'number' => '4', + 'text' => 'Koneksi (teman, dosen, saudara/keluarga, dll)' + ], + [ + 'number' => '5', + 'text' => 'Info lowongan kemahasiswaan (PKMA)' + ], + [ + 'number' => '6', + 'text' => 'Lainnya, sebutkan', + 'fillable' => true + ] + ] + ], + [ + 'number' => '8', + 'text' => 'Sejauh mana pekerjaan Saudara yang terakhir/sekarang sesuai dengan harapan ketika pertama kali belajar di PT Lepisi', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat sesuai harapan' + ], + [ + 'number' => '2', + 'text' => 'Sesuai harapan' + ], + [ + 'number' => '3', + 'text' => 'Kurang sesuai harapan' + ], + [ + 'number' => '4', + 'text' => 'Tidak sesuai harapan' + ] + ] + ], + [ + 'number' => '9', + 'text' => 'Apakah Saudara puas dengan pekerjaan Saudara yang terakhir/sekarang', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat puas' + ], + [ + 'number' => '2', + 'text' => 'Puas' + ], + [ + 'number' => '3', + 'text' => 'Kurang puas' + ], + [ + 'number' => '4', + 'text' => 'Tidak puas' + ] + ] + ], + [ + 'number' => '10', + 'text' => 'Secara umum, apa pertimbangan utama Saudara dalam memilih pekerjaan yang terakhir/sekarang', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Gaji memadai' + ], + [ + 'number' => '2', + 'text' => 'Sesuai bidang keilmuan' + ], + [ + 'number' => '3', + 'text' => 'Mendapatkan pengalaman' + ], + [ + 'number' => '4', + 'text' => 'Mendapatkan ilmu pengetahuan' + ], + [ + 'number' => '5', + 'text' => 'Mendapatkan ketrampilan' + ], + [ + 'number' => '6', + 'text' => 'Lainnya, sebutkan', + 'fillable' => true + ] + ] + ], + [ + 'number' => '11', + 'text' => 'Berapa rata-rata pendapatan (take home pay = seluruh pendapatan per bulan termasuk bonus, insentif, dsb.) Saudara pada pekerjaan terakhir/sekarang', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => '< Rp. 1.000.000' + ], + [ + 'number' => '2', + 'text' => '> Rp. 1.000.000 - Rp. 3.000.000' + ], + [ + 'number' => '3', + 'text' => '> Rp. 3.000.000 - Rp. 5.000.000 ' + ], + [ + 'number' => '4', + 'text' => '> Rp. 5.000.000 - Rp. 7.500.000' + ], + [ + 'number' => '5', + 'text' => '> Rp. 7.500.000 - Rp. 10.000.000' + ], + [ + 'number' => '6', + 'text' => '> Rp. 10.000.000 - Rp. 12.500.000' + ], + [ + 'number' => '7', + 'text' => '> Rp. 12.500.000- Rp. 15.000.000' + ], + [ + 'number' => '8', + 'text' => '> Rp. 15.000.000' + ] + ] + ], + [ + 'number' => '12', + 'text' => 'Apakah pekerjaan Saudara ini berhubungan dengan bidang ilmu yang Saudara pelajari', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Ya' + ], + [ + 'number' => '2', + 'text' => 'Tidak' + ] + ] + ], + [ + 'number' => '13', + 'text' => 'Menurut Saudara, bagaimana kebutuhan institusi tempat Saudara bekerja terhadap lulusan dari program studi/jurusan Saudara', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat tinggi' + ], + [ + 'number' => '2', + 'text' => 'Tinggi' + ], + [ + 'number' => '3', + 'text' => 'Rendah ' + ], + [ + 'number' => '4', + 'text' => 'Sangat rendah' + ] + ] + ], + [ + 'number' => '14', + 'text' => 'Sebelumnya, apakah Saudara pernah bekerja di tempat lain', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Ya' + ], + [ + 'number' => '2', + 'text' => 'Tidak', + 'description' => 'Langsung ke seksi 4' + ] + ] + ], + [ + 'number' => '15', + 'text' => 'Sudah berapa kali Saudara berganti pekerjaan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => '1 kali' + ], + [ + 'number' => '2', + 'text' => '2 kali' + ], + [ + 'number' => '3', + 'text' => '3 kali' + ], + [ + 'number' => '4', + 'text' => 'Lebih dari 3 kali, sebutkan', + 'fillable' => true + ] + ] + ], + [ + 'number' => '16', + 'text' => 'Apakah Saudara masih ingin berpindah kerja', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Ya', + 'fillable' => true + ], + [ + 'number' => '2', + 'text' => 'Tidak' + ] + ] + ], + [ + 'number' => '17', + 'text' => 'Nama tempat bekerja pertama kali', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '18', + 'text' => 'Jabatan/posisi terakhir dalam pekerjaan pertama', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '19', + 'text' => 'Bulan dan tahun mulai bekerja (pertama)', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '20', + 'text' => 'Bulan dan tahun berhenti bekerja (pertama)', + 'question_type' => 'text', + 'creator_id' => '1' + ], + [ + 'number' => '21', + 'text' => 'Bagaimana proses Saudara mendapatkan pekerjaan pertama ini', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Aktif (mencari sendiri)' + ], + [ + 'number' => '2', + 'text' => 'Pasif (ditawari pekerjaan)' + ] + ] + ], + [ + 'number' => '22', + 'text' => 'Dari mana Saudara mengetahui atau mendapatkan informasi mengenai adanya pekerjaan pertama ini', + 'question_type' => 'multichoice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Iklan' + ], + [ + 'number' => '2', + 'text' => 'Internet' + ], + [ + 'number' => '3', + 'text' => 'Pengumuman di kampus' + ], + [ + 'number' => '4', + 'text' => 'Koneksi (teman, dosen, Saudara/keluarga, dll)' + ], + [ + 'number' => '5', + 'text' => 'PKMA (Pengembangan Karir Mahasiswa dan Alumni) PT LEPISI' + ], + [ + 'number' => '6', + 'text' => 'Lainnya, sebutkan', + 'fillable' => true + ] + ] + ], + [ + 'number' => '23', + 'text' => 'Sejauh mana pekerjaan pertama Saudara sesuai dengan harapan ketika pertama kali belajar di PT LEPISI', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat sesuai dengan harapan' + ], + [ + 'number' => '2', + 'text' => 'Sesuai harapan' + ], + [ + 'number' => '3', + 'text' => 'Kurang sesuai harapan' + ], + [ + 'number' => '4', + 'text' => 'Tidak sesuai harapan' + ] + ] + ], + [ + 'number' => '24', + 'text' => 'Apakah Saudara puas dengan pekerjaan pertama Saudara', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Ya' + ], + [ + 'number' => '2', + 'text' => 'Tidak' + ] + ] + ], + [ + 'number' => '25', + 'text' => 'Secara umum, apa pertimbangan utama Saudara dalam memilih pekerjaan pertama', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Gaji memadai' + ], + [ + 'number' => '2', + 'text' => 'Sesuai bidang keilmuan' + ], + [ + 'number' => '3', + 'text' => 'Mendapatkan pengalaman' + ], + [ + 'number' => '4', + 'text' => 'Mendapatkan ilmu pengetahuan' + ], + [ + 'number' => '5', + 'text' => 'Mendapatkan keterampilan' + ], + [ + 'number' => '6', + 'text' => 'Lainnya, sebutkan', + 'fillable' => true + ] + ] + ], + [ + 'number' => '26', + 'text' => 'Berapa rata-rata pendapatan (take home pay = seluruh pendapatan per bulan termasuk bonus, insentif, dsb.) Saudara pada pekerjaan pertama', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => '< Rp. 1.000.000' + ], + [ + 'number' => '2', + 'text' => '> Rp. 1.000.000 - Rp. 3.000.000' + ], + [ + 'number' => '3', + 'text' => '> Rp. 3.000.000 - Rp. 5.000.000 ' + ], + [ + 'number' => '4', + 'text' => '> Rp. 5.000.000 - Rp. 7.500.000' + ], + [ + 'number' => '5', + 'text' => '> Rp. 7.500.000 - Rp. 10.000.000' + ], + [ + 'number' => '6', + 'text' => '> Rp. 10.000.000 - Rp. 12.500.000' + ], + [ + 'number' => '7', + 'text' => '> Rp. 12.500.000- Rp. 15.000.000' + ], + [ + 'number' => '8', + 'text' => '> Rp. 15.000.000' + ] + ] + ], + [ + 'number' => '27', + 'text' => 'Apakah pekerjaan pertama Saudara berhubungan dengan bidang ilmu yang Saudara pelajari di program studi', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Ya' + ], + [ + 'number' => '2', + 'text' => 'Tidak, mengapa', + 'fillable' => true + ] + ] + ] + ] + ], + [ + 'title' => 'Relevansi Pendidikan dengan Pekerjaan', + 'creator_id' => '1', + 'questions' => [ + [ + 'number' => '1', + 'text' => 'Apakah pendidikan yang Saudara dapat di program studi yang anada pilih relevan dengan pekerjaan Saudara', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Ya' + ], + [ + 'number' => '2', + 'text' => 'Tidak, mengapa', + 'fillable' => true + ] + ] + ], + [ + 'number' => '2', + 'text' => 'Dari pengalaman Saudara bekerja, apa saran praktis Saudara untuk pendidikan di PT Lepisi dalam rangka meningkatkan kesesuaian antara pendidikan dengan lapangan pekerjaan', + 'question_type' => 'text', + 'creator_id' => '1' + ] + ] + ], + [ + 'title' => 'Pengalaman pembelajaran dan masukan bagi pendidikan PT Lepisi', + 'description' => 'Saat belajar di PT Lepisi, menurut Saudara seberapa penting pengalaman pembelajaran berikut ini memberikan kontribusi dalam dunia kerja', + 'creator_id' => '1', + 'questions' => [ + [ + 'number' => '1', + 'text' => 'Pengalaman belajar di dalam kelas', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat penting' + ], + [ + 'number' => '2', + 'text' => 'Penting' + ], + [ + 'number' => '3', + 'text' => 'Kurang penting' + ], + [ + 'number' => '4', + 'text' => 'Tidak penting' + ] + ] + ], + [ + 'number' => '2', + 'text' => 'Pengalaman belajar di laboratorium', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat penting' + ], + [ + 'number' => '2', + 'text' => 'Penting' + ], + [ + 'number' => '3', + 'text' => 'Kurang penting' + ], + [ + 'number' => '4', + 'text' => 'Tidak penting' + ] + ] + ], + [ + 'number' => '3', + 'text' => 'Pengalaman belajar di masyarakat', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat penting' + ], + [ + 'number' => '2', + 'text' => 'Penting' + ], + [ + 'number' => '3', + 'text' => 'Kurang penting' + ], + [ + 'number' => '4', + 'text' => 'Tidak penting' + ] + ] + ], + [ + 'number' => '4', + 'text' => 'Pengalaman magang di perusahaan/instansi', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat penting' + ], + [ + 'number' => '2', + 'text' => 'Penting' + ], + [ + 'number' => '3', + 'text' => 'Kurang penting' + ], + [ + 'number' => '4', + 'text' => 'Tidak penting' + ] + ] + ], + [ + 'number' => '5', + 'text' => 'Pengalamanbelajardalamorganisasikmhswn', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat penting' + ], + [ + 'number' => '2', + 'text' => 'Penting' + ], + [ + 'number' => '3', + 'text' => 'Kurang penting' + ], + [ + 'number' => '4', + 'text' => 'Tidak penting' + ] + ] + ], + [ + 'number' => '6', + 'text' => 'Pengalaman belajar dalam pergaulan kampus', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat penting' + ], + [ + 'number' => '2', + 'text' => 'Penting' + ], + [ + 'number' => '3', + 'text' => 'Kurang penting' + ], + [ + 'number' => '4', + 'text' => 'Tidak penting' + ] + ] + ], + [ + 'number' => '7', + 'text' => 'Pengalaman belajar mandiri', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat penting' + ], + [ + 'number' => '2', + 'text' => 'Penting' + ], + [ + 'number' => '3', + 'text' => 'Kurang penting' + ], + [ + 'number' => '4', + 'text' => 'Tidak penting' + ] + ] + ], + ] + ], + [ + 'title' => 'Indikator Kompetisi dan Daya Saing', + 'creator_id' => '1', + 'questions' => [ + [ + 'number' => '1', + 'text' => 'Saat baru lulus, sejauh mana Saudara merasa mampu bersaing dng lulusan perguruan tinggi lain', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat mampu' + ], + [ + 'number' => '2', + 'text' => 'Mampu' + ], + [ + 'number' => '3', + 'text' => 'Kurang mampu' + ], + [ + 'number' => '4', + 'text' => 'Sangat tidak mampu' + ], + ] + ], + [ + 'number' => '2', + 'text' => 'Sejauh ini, menurut Saudara lulusan PT Lepisi yang bagaimana yg diperlukan oleh pasar/lapangan kerja', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'generik (umum)' + ], + [ + 'number' => '2', + 'text' => 'spesifik' + ] + ] + ], + [ + 'number' => '3', + 'text' => 'Saat baru lulus, menurut penilaian Saudara, sejauh mana Saudara menguasai kompetensi Pengetahuan umum', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat menguasai' + ], + [ + 'number' => '2', + 'text' => 'Menguasai' + ], + [ + 'number' => '3', + 'text' => 'Kurang menguasai' + ], + [ + 'number' => '4', + 'text' => 'Tidak menguasai' + ] + ] + ], + [ + 'number' => '4', + 'text' => 'Saat baru lulus, menurut penilaian Saudara, sejauh mana Saudara menguasai kompetensi Bahasa inggris', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat menguasai' + ], + [ + 'number' => '2', + 'text' => 'Menguasai' + ], + [ + 'number' => '3', + 'text' => 'Kurang menguasai' + ], + [ + 'number' => '4', + 'text' => 'Tidak menguasai' + ] + ] + ], + [ + 'number' => '5', + 'text' => 'Saat baru lulus, menurut penilaian Saudara, sejauh mana Saudara menguasai kompetensi Komputer', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat menguasai' + ], + [ + 'number' => '2', + 'text' => 'Menguasai' + ], + [ + 'number' => '3', + 'text' => 'Kurang menguasai' + ], + [ + 'number' => '4', + 'text' => 'Tidak menguasai' + ] + ] + ], + [ + 'number' => '6', + 'text' => 'Saat baru lulus, menurut penilaian Saudara, sejauh mana Saudara menguasai kompetensi Metodologi penelitian', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat menguasai' + ], + [ + 'number' => '2', + 'text' => 'Menguasai' + ], + [ + 'number' => '3', + 'text' => 'Kurang menguasai' + ], + [ + 'number' => '4', + 'text' => 'Tidak menguasai' + ] + ] + ], + [ + 'number' => '7', + 'text' => 'Saat baru lulus, menurut penilaian Saudara, sejauh mana Saudara menguasai kompetensi Kerjasama tim', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat menguasai' + ], + [ + 'number' => '2', + 'text' => 'Menguasai' + ], + [ + 'number' => '3', + 'text' => 'Kurang menguasai' + ], + [ + 'number' => '4', + 'text' => 'Tidak menguasai' + ] + ] + ], + [ + 'number' => '8', + 'text' => 'Saat baru lulus, menurut penilaian Saudara, sejauh mana Saudara menguasai kompetensi Keterampilan komunikasi lisan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat menguasai' + ], + [ + 'number' => '2', + 'text' => 'Menguasai' + ], + [ + 'number' => '3', + 'text' => 'Kurang menguasai' + ], + [ + 'number' => '4', + 'text' => 'Tidak menguasai' + ] + ] + ], + [ + 'number' => '9', + 'text' => 'Saat baru lulus, menurut penilaian Saudara, sejauh mana Saudara menguasai kompetensi Keterampilan komunikasi tertulis', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat menguasai' + ], + [ + 'number' => '2', + 'text' => 'Menguasai' + ], + [ + 'number' => '3', + 'text' => 'Kurang menguasai' + ], + [ + 'number' => '4', + 'text' => 'Tidak menguasai' + ] + ] + ], + [ + 'number' => '10', + 'text' => 'Saat baru lulus, menurut penilaian Saudara, sejauh mana Saudara menguasai kompetensi Proses pemberdayaan masyarakat', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat menguasai' + ], + [ + 'number' => '2', + 'text' => 'Menguasai' + ], + [ + 'number' => '3', + 'text' => 'Kurang menguasai' + ], + [ + 'number' => '4', + 'text' => 'Tidak menguasai' + ] + ] + ], + [ + 'number' => '11', + 'text' => 'Saat baru lulus, menurut penilaian Saudara, sejauh mana Saudara menguasai kompetensi Pengetahuan teoritis spesifik', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat menguasai' + ], + [ + 'number' => '2', + 'text' => 'Menguasai' + ], + [ + 'number' => '3', + 'text' => 'Kurang menguasai' + ], + [ + 'number' => '4', + 'text' => 'Tidak menguasai' + ] + ] + ], + [ + 'number' => '12', + 'text' => 'Saat baru lulus, menurut penilaian Saudara, sejauh mana Saudara menguasai kompetensi Pengetahuan praktis spesifik', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat menguasai' + ], + [ + 'number' => '2', + 'text' => 'Menguasai' + ], + [ + 'number' => '3', + 'text' => 'Kurang menguasai' + ], + [ + 'number' => '4', + 'text' => 'Tidak menguasai' + ] + ] + ], + [ + 'number' => '13', + 'text' => 'Saat baru lulus, menurut penilaian Saudara, sejauh mana Saudara menguasai kompetensi Kepemimpinan/leadership', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat menguasai' + ], + [ + 'number' => '2', + 'text' => 'Menguasai' + ], + [ + 'number' => '3', + 'text' => 'Kurang menguasai' + ], + [ + 'number' => '4', + 'text' => 'Tidak menguasai' + ] + ] + ], + [ + 'number' => '14', + 'text' => 'Saat baru lulus, menurut penilaian Saudara, sejauh mana Saudara menguasai kompetensi Manajemen', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat menguasai' + ], + [ + 'number' => '2', + 'text' => 'Menguasai' + ], + [ + 'number' => '3', + 'text' => 'Kurang menguasai' + ], + [ + 'number' => '4', + 'text' => 'Tidak menguasai' + ] + ] + ], + [ + 'number' => '15', + 'text' => 'Saat baru lulus, menurut penilaian Saudara, sejauh mana Saudara menguasai kompetensi Akuntansi dan perpajakan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat menguasai' + ], + [ + 'number' => '2', + 'text' => 'Menguasai' + ], + [ + 'number' => '3', + 'text' => 'Kurang menguasai' + ], + [ + 'number' => '4', + 'text' => 'Tidak menguasai' + ] + ] + ], + [ + 'number' => '16', + 'text' => 'Saat baru lulus, menurut penilaian Saudara, sejauh mana Saudara menguasai kompetensi Manajemen administrasi akuntansi', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat menguasai' + ], + [ + 'number' => '2', + 'text' => 'Menguasai' + ], + [ + 'number' => '3', + 'text' => 'Kurang menguasai' + ], + [ + 'number' => '4', + 'text' => 'Tidak menguasai' + ] + ] + ], + [ + 'number' => '17', + 'text' => 'Saat baru lulus, menurut penilaian Saudara, sejauh mana Saudara menguasai kompetensi Kesekretarisan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat menguasai' + ], + [ + 'number' => '2', + 'text' => 'Menguasai' + ], + [ + 'number' => '3', + 'text' => 'Kurang menguasai' + ], + [ + 'number' => '4', + 'text' => 'Tidak menguasai' + ] + ] + ], + [ + 'number' => '18', + 'text' => 'Saat baru lulus, menurut penilaian Saudara, sejauh mana Saudara menguasai kompetensi Kewirausahaan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat menguasai' + ], + [ + 'number' => '2', + 'text' => 'Menguasai' + ], + [ + 'number' => '3', + 'text' => 'Kurang menguasai' + ], + [ + 'number' => '4', + 'text' => 'Tidak menguasai' + ] + ] + ], + [ + 'number' => '19', + 'text' => 'Dalam pekerjaan, menurut penilaian Saudara sejauh mana kompetensi Pengetahuan umum diperlukan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat dibutuhkan' + ], + [ + 'number' => '2', + 'text' => 'Dibutuhkan' + ], + [ + 'number' => '3', + 'text' => 'Kurang dibutuhkan' + ], + [ + 'number' => '4', + 'text' => 'Tidak dibutuhkan' + ] + ] + ], + [ + 'number' => '20', + 'text' => 'Dalam pekerjaan, menurut penilaian Saudara sejauh mana kompetensi Bahasa inggris diperlukan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat dibutuhkan' + ], + [ + 'number' => '2', + 'text' => 'Dibutuhkan' + ], + [ + 'number' => '3', + 'text' => 'Kurang dibutuhkan' + ], + [ + 'number' => '4', + 'text' => 'Tidak dibutuhkan' + ] + ] + ], + [ + 'number' => '21', + 'text' => 'Dalam pekerjaan, menurut penilaian Saudara sejauh mana kompetensi Komputer diperlukan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat dibutuhkan' + ], + [ + 'number' => '2', + 'text' => 'Dibutuhkan' + ], + [ + 'number' => '3', + 'text' => 'Kurang dibutuhkan' + ], + [ + 'number' => '4', + 'text' => 'Tidak dibutuhkan' + ] + ] + ], + [ + 'number' => '22', + 'text' => 'Dalam pekerjaan, menurut penilaian Saudara sejauh mana kompetensi Metodologi penelitian diperlukan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat dibutuhkan' + ], + [ + 'number' => '2', + 'text' => 'Dibutuhkan' + ], + [ + 'number' => '3', + 'text' => 'Kurang dibutuhkan' + ], + [ + 'number' => '4', + 'text' => 'Tidak dibutuhkan' + ] + ] + ], + [ + 'number' => '23', + 'text' => 'Dalam pekerjaan, menurut penilaian Saudara sejauh mana kompetensi Kerjasama tim diperlukan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat dibutuhkan' + ], + [ + 'number' => '2', + 'text' => 'Dibutuhkan' + ], + [ + 'number' => '3', + 'text' => 'Kurang dibutuhkan' + ], + [ + 'number' => '4', + 'text' => 'Tidak dibutuhkan' + ] + ] + ], + [ + 'number' => '24', + 'text' => 'Dalam pekerjaan, menurut penilaian Saudara sejauh mana kompetensi Keterampilan komunikasi lisan diperlukan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat dibutuhkan' + ], + [ + 'number' => '2', + 'text' => 'Dibutuhkan' + ], + [ + 'number' => '3', + 'text' => 'Kurang dibutuhkan' + ], + [ + 'number' => '4', + 'text' => 'Tidak dibutuhkan' + ] + ] + ], + [ + 'number' => '25', + 'text' => 'Dalam pekerjaan, menurut penilaian Saudara sejauh mana kompetensi Keterampilan komunikasi tertulis diperlukan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat dibutuhkan' + ], + [ + 'number' => '2', + 'text' => 'Dibutuhkan' + ], + [ + 'number' => '3', + 'text' => 'Kurang dibutuhkan' + ], + [ + 'number' => '4', + 'text' => 'Tidak dibutuhkan' + ] + ] + ], + [ + 'number' => '26', + 'text' => 'Dalam pekerjaan, menurut penilaian Saudara sejauh mana kompetensi Proses pemberdayaan masyarakat diperlukan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat dibutuhkan' + ], + [ + 'number' => '2', + 'text' => 'Dibutuhkan' + ], + [ + 'number' => '3', + 'text' => 'Kurang dibutuhkan' + ], + [ + 'number' => '4', + 'text' => 'Tidak dibutuhkan' + ] + ] + ], + [ + 'number' => '27', + 'text' => 'Dalam pekerjaan, menurut penilaian Saudara sejauh mana kompetensi Pengetahuan teoritis spesifik diperlukan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat dibutuhkan' + ], + [ + 'number' => '2', + 'text' => 'Dibutuhkan' + ], + [ + 'number' => '3', + 'text' => 'Kurang dibutuhkan' + ], + [ + 'number' => '4', + 'text' => 'Tidak dibutuhkan' + ] + ] + ], + [ + 'number' => '28', + 'text' => 'Dalam pekerjaan, menurut penilaian Saudara sejauh mana kompetensi Pengetahuan praktis spesifik diperlukan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat dibutuhkan' + ], + [ + 'number' => '2', + 'text' => 'Dibutuhkan' + ], + [ + 'number' => '3', + 'text' => 'Kurang dibutuhkan' + ], + [ + 'number' => '4', + 'text' => 'Tidak dibutuhkan' + ] + ] + ], + [ + 'number' => '29', + 'text' => 'Dalam pekerjaan, menurut penilaian Saudara sejauh mana kompetensi Kepemimpinan/leadership diperlukan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat dibutuhkan' + ], + [ + 'number' => '2', + 'text' => 'Dibutuhkan' + ], + [ + 'number' => '3', + 'text' => 'Kurang dibutuhkan' + ], + [ + 'number' => '4', + 'text' => 'Tidak dibutuhkan' + ] + ] + ], + [ + 'number' => '30', + 'text' => 'Dalam pekerjaan, menurut penilaian Saudara sejauh mana kompetensi Manajemen diperlukan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat dibutuhkan' + ], + [ + 'number' => '2', + 'text' => 'Dibutuhkan' + ], + [ + 'number' => '3', + 'text' => 'Kurang dibutuhkan' + ], + [ + 'number' => '4', + 'text' => 'Tidak dibutuhkan' + ] + ] + ], + [ + 'number' => '31', + 'text' => 'Dalam pekerjaan, menurut penilaian Saudara sejauh mana kompetensi Akuntansi dan perpajakan diperlukan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat dibutuhkan' + ], + [ + 'number' => '2', + 'text' => 'Dibutuhkan' + ], + [ + 'number' => '3', + 'text' => 'Kurang dibutuhkan' + ], + [ + 'number' => '4', + 'text' => 'Tidak dibutuhkan' + ] + ] + ], + [ + 'number' => '32', + 'text' => 'Dalam pekerjaan, menurut penilaian Saudara sejauh mana kompetensi Manajemen administrasi akuntansi diperlukan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat dibutuhkan' + ], + [ + 'number' => '2', + 'text' => 'Dibutuhkan' + ], + [ + 'number' => '3', + 'text' => 'Kurang dibutuhkan' + ], + [ + 'number' => '4', + 'text' => 'Tidak dibutuhkan' + ] + ] + ], + [ + 'number' => '33', + 'text' => 'Dalam pekerjaan, menurut penilaian Saudara sejauh mana kompetensi Kesekretarisan diperlukan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat dibutuhkan' + ], + [ + 'number' => '2', + 'text' => 'Dibutuhkan' + ], + [ + 'number' => '3', + 'text' => 'Kurang dibutuhkan' + ], + [ + 'number' => '4', + 'text' => 'Tidak dibutuhkan' + ] + ] + ], + [ + 'number' => '34', + 'text' => 'Dalam pekerjaan, menurut penilaian Saudara sejauh mana kompetensi Kewirausahaan diperlukan', + 'question_type' => 'choice', + 'creator_id' => '1', + 'choices' => [ + [ + 'number' => '1', + 'text' => 'Sangat dibutuhkan' + ], + [ + 'number' => '2', + 'text' => 'Dibutuhkan' + ], + [ + 'number' => '3', + 'text' => 'Kurang dibutuhkan' + ], + [ + 'number' => '4', + 'text' => 'Tidak dibutuhkan' + ] + ] + ] + ] + ] + ] + ]]; + } +} diff --git a/database/seeds/RespondentSeeder.php b/database/seeds/RespondentSeeder.php new file mode 100644 index 0000000..b5fae39 --- /dev/null +++ b/database/seeds/RespondentSeeder.php @@ -0,0 +1,25 @@ + 'respondent1', + 'handphone' => '0123456789', + 'email' => 'respondent1@company.com', + 'gender' => 'm', + 'occupation' => 'staff', + 'birthdate' => '2017/01/01', + 'category_id' => '1' + ]); + } +} diff --git a/database/seeds/UsersTableSeeder.php b/database/seeds/UsersTableSeeder.php new file mode 100644 index 0000000..332cafc --- /dev/null +++ b/database/seeds/UsersTableSeeder.php @@ -0,0 +1,22 @@ + 'user1', + 'name' => 'User 1', + 'email' => 'user1@company.com', + 'password' => 'user1' + ]); + } +} diff --git a/routes/api.php b/routes/api.php index c641ca5..7966902 100644 --- a/routes/api.php +++ b/routes/api.php @@ -13,6 +13,26 @@ use Illuminate\Http\Request; | */ -Route::middleware('auth:api')->get('/user', function (Request $request) { - return $request->user(); +// Route::middleware('auth:api')->get('/user', function (Request $request) { +// return $request->user(); +// }); + +$api = app('Dingo\Api\Routing\Router'); + +// $api->version('v1', function ($api) { +// $api->get('questionnaires', function($id) { +// echo $id; +// }); +// }); +$api->version('v1', function ($api) { + $api->resource('questionnaires', 'App\Http\Controllers\QuestionnaireController'); + $api->resource('questionnaires/{questionnaire}/sections', 'App\Http\Controllers\QuestionnaireSectionController'); + $api->resource('sections', 'App\Http\Controllers\SectionController'); + $api->resource('sections/{section}/questions', 'App\Http\Controllers\SectionQuestionController'); + $api->resource('questions', 'App\Http\Controllers\QuestionController'); + $api->resource('questions/{question}/answers', 'App\Http\Controllers\QuestionAnswerController'); + $api->resource('categories', 'App\Http\Controllers\CategoryController'); + $api->resource('answers', 'App\Http\Controllers\AnswerController'); + $api->resource('respondents', 'App\Http\Controllers\RespondentController'); + $api->resource('users', 'App\Http\Controllers\UserController'); }); diff --git a/tests/Feature/ViewingQuestionnaireTest.php b/tests/Feature/ViewingQuestionnaireTest.php index 0b18584..244be7e 100644 --- a/tests/Feature/ViewingQuestionnaireTest.php +++ b/tests/Feature/ViewingQuestionnaireTest.php @@ -14,7 +14,7 @@ class ViewingQuestionnaireTest extends TestCase */ public function testICanViewListOfQuestionnaire() { - $response = $this->get('/v0/questionnaire'); + $response = $this->get('/v1/questionnaires'); $response->assertStatus(200); }