PHP code example of bensondevs / laravel-faq

1. Go to this page and download the library: Download bensondevs/laravel-faq 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/ */

    

bensondevs / laravel-faq example snippets


use Bensondevs\LaravelFaq\Faq;

$faq = Faq::add('What is Laravel?', 'Laravel is a PHP framework.');

$faq = Faq::add(
    question: 'What is PHP?', 
    answer: 'A scripting language.', 
    locale: 'en', 
    tag: 'php',
);

$faq = Faq::add(
    question: 'What is Tailwind?', 
    answer: 'A CSS framework.', 
    locale: 'en', 
    tag: ['css', 'tailwind'],
);

Faq::all(); // returns FaqResource::collection

use Bensondevs\LaravelFaq\Models\Tag;

Faq::all('php');
Faq::all(Tag::first());
Faq::all(['php', 'laravel']);
bash
# Publish config file
php artisan vendor:publish --tag=faq-config

# Publish migrations file
php artisan vendor:publish --tag=faq-migrations