PHP code example of multek / laravel-feedback

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

    

multek / laravel-feedback example snippets


use Multek\LaravelFeedback\Facades\Feedback;

// Create feedback
$feedback = Feedback::create([
    'type' => 'bug',
    'content' => 'The button does not work',
    'user_id' => auth()->id(),
    'metadata' => [
        'browser' => 'Chrome 120',
        'page_url' => 'https://app.com/dashboard',
    ],
]);

// Query feedback
$bugs = Feedback::ofType('bug')->get();
$userFeedback = Feedback::forUser($user)->get();
$recent = Feedback::query()->recent(7)->get();

use Multek\LaravelFeedback\Traits\HasFeedback;

class User extends Authenticatable
{
    use HasFeedback;
}

$user->submitFeedback([
    'type' => 'feature',
    'content' => 'Please add dark mode',
    'metadata' => ['priority' => 'high'],
]);

$user->feedbacks; // Collection of user's feedback

'route' => [
    'enabled' => true,
    'prefix' => 'api/feedback',
    'middleware' => ['api', 'auth:sanctum'],
],

use Multek\LaravelFeedback\Events\FeedbackReceived;

class SendSlackNotification
{
    public function handle(FeedbackReceived $event): void
    {
        // $event->feedback
    }
}

'metadata' => [
    'validation' => [
        'browser' => '
bash
php artisan vendor:publish --tag=feedback-config
php artisan vendor:publish --tag=feedback-migrations
php artisan migrate