PHP code example of sfolador / support

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

    

sfolador / support example snippets


return [
    /*
    |--------------------------------------------------------------------------
    | Support Email
    |--------------------------------------------------------------------------
    |
    | The email address where support requests will be sent.
    |
    */
    'support_email' => env('SUPPORT_EMAIL'),

    /*
    |--------------------------------------------------------------------------
    | Support Types
    |--------------------------------------------------------------------------
    |
    | The types of support requests that users can submit.
    | The key is stored in the database, the value is displayed to the user.
    |
    */
    'support_types' => [
        'issue' => 'Technical Issue',
        'email' => 'Email Support',
        'data_removal' => 'Data Removal Request',
        'inquiry' => 'General Inquiry',
    ],

    /*
    |--------------------------------------------------------------------------
    | reCAPTCHA Configuration
    |--------------------------------------------------------------------------
    |
    | Enable or disable reCAPTCHA for the support form.
    | If enabled, you must provide your site key and secret key.
    |
    */
    'recaptcha' => [
        'enabled' => env('SUPPORT_RECAPTCHA_ENABLED', false),
        'site_key' => env('SUPPORT_RECAPTCHA_SITE_KEY'),
        'secret_key' => env('SUPPORT_RECAPTCHA_SECRET_KEY'),
    ],

    /*
    |--------------------------------------------------------------------------
    | Routes Configuration
    |--------------------------------------------------------------------------
    |
    | Configure the middleware and route prefix for the support page.
    |
    */
    'middleware' => ['web'],
    'route_prefix' => 'support',

    /*
    |--------------------------------------------------------------------------
    | Layout Configuration
    |--------------------------------------------------------------------------
    |
    | The layout that the support page should extend.
    | Use 'support::layouts.app' for the default layout,
    | or specify your own (e.g., 'layouts.app').
    |
    */
    'layout' => 'support::layouts.app',

    /*
    |--------------------------------------------------------------------------
    | Page Title
    |--------------------------------------------------------------------------
    |
    | The title displayed on the support page.
    |
    */
    'page_title' => 'Contact Support',
];

'layout' => 'layouts.app', // Your layout file

'support_types' => [
    'bug' => 'Bug Report',
    'feature' => 'Feature Request',
    'billing' => 'Billing Question',
    'other' => 'Other',
],

use Sfolador\Support\Filament\SupportPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugins([
            SupportPlugin::make(),
        ]);
}

use Sfolador\Support\Models\SupportRequest;

// Get all requests
$requests = SupportRequest::all();

// Get requests by type
$issues = SupportRequest::where('support_type', 'issue')->get();

// Get recent requests
$recent = SupportRequest::latest()->take(10)->get();
bash
php artisan vendor:publish --tag="support-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="support-config"
bash
php artisan vendor:publish --tag="support-views"
bash
php artisan vendor:publish --tag="support-translations"