Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX]Retrieving All FAQ Entries #603

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/Http/Controllers/Api/V1/Admin/FaqController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function store(Request $request)
'question' => $validatedData['question'],
'answer' => $validatedData['answer'],
'category' => $validatedData['category'],
// 'role' => Role::USER,
'created_by' => auth()->user()->name,
]);

return response()->json([
Expand Down Expand Up @@ -62,6 +62,7 @@ public function index()
'question' => $faq->question,
'answer' => $faq->answer,
'category' => $faq->category,
'created_by' => $faq->created_by
];
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public function up(): void
{
Schema::table('faqs', function (Blueprint $table) {
$table->string('category')->nullable();
$table->string('created_by')->nullable();
});
}

Expand Down
3 changes: 2 additions & 1 deletion tests/Feature/FaqControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function test_admin_can_create_faq()
'category',
'created_at',
'updated_at',
'created_by'
]
]);

Expand All @@ -58,7 +59,7 @@ public function test_unauthorized_user_cannot_create_faq()
$payload = [
'question' => 'Unauthorized question?',
'answer' => 'This should not be created.',
'category' => 'Test'
'category' => 'Test',
];

$response = $this->withHeaders(['Authorization' => "Bearer $token"])
Expand Down
Loading