1. Go to this page and download the library: Download detosphere-ltd/laravel-faqs library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$faq = (new CreateFAQAction)->execute([
'question' => 'What does your app do?',
'answer' => 'It helps manage Frequently asked questions on any application.',
'type' => 'type'
]);
$faq = \DetosphereLtd\LaravelFaqs\Models\Faq::first();
$updatedFaq = (new UpdateFAQAction)->execute($faq, [
'question' => 'What does your app do?',
'answer' => 'It helps manage Frequently asked questions on any application.',
'type' => 'type'
]);
$faq = \DetosphereLtd\LaravelFaqs\Models\Faq::first();
(new DeleteFAQAction)->execute($faq);
$faq = \DetosphereLtd\LaravelFaqs\Models\Faq::first();
$incrementedYes = (new IncrementFAQHelpfulnessAction)->execute($faq, 'yes');
$incrementedNo = (new IncrementFAQHelpfulnessAction)->execute($faq, 'no');
(new CreateFAQAction)->execute([
'question' => 'What does your app do?',
'answer' => 'It helps manage Frequently asked questions on any application.',
'type' => 'type'
]);
app(CreateFAQAction::class)->execute([
'question' => 'What does your app do?',
'answer' => 'It helps manage Frequently asked questions on any application.',
'type' => 'type'
]);
namespace App\Http\Controllers;
use DetosphereLtd\LaravelFaqs\Actions\CreateFAQAction;
class FaqController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function store(Request $request, CreateFAQAction $action)
{
$action->execute([
'question' => $request->question,
'answer'=> $request->answer,
'type' => $request->type
]);
return response(201);
}
}