PHP code example of empire2 / gaze-ghostwriter

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

    

empire2 / gaze-ghostwriter example snippets


'enabled'      => env('GHOSTWRITER_ENABLED', true),
'gaze_enabled' => env('GHOSTWRITER_GAZE_ENABLED', false), // PII boundary on/off
'user_model'   => \App\Models\User::class,                // Host User model
'layout'       => 'components.layouts.app',                // Blade layout for admin pages
'middleware'   => ['web', 'auth'],                         // Add 'role:admin' etc. here
'route_prefix' => 'ghostwriter',

use Empire2\GazeGhostwriter\Concerns\HasGhostwriterUserData;

class User extends Authenticatable
{
    use HasGhostwriterUserData;
    // ...
}

// config/gaze-ghostwriter.php
'middleware' => ['web', 'auth', 'role:admin|super-admin'],

'layout' => 'layouts.admin',

'routes' => [
    'customer_show' => 'admin.customers.show',
    'ticket_show'   => 'admin.tickets.show',
    'ticket_board'  => 'admin.tickets.board',
],
'ticket_model' => \App\Models\Ticket::class,

use Empire2\GazeGhostwriter\Jobs\ProcessGhostwriterInboxJob;
use Empire2\GazeGhostwriter\Services\DraftGeneratorService;
use Empire2\GazeGhostwriter\Models\SupportMailMessage;

// 1. Pull new mail and generate drafts (production: enqueue on a schedule).
ProcessGhostwriterInboxJob::dispatch();

// 2. Generate a draft for a single message ad-hoc.
$service = app(DraftGeneratorService::class);
$draft   = $service->generateForMessage(SupportMailMessage::find($id));
bash
composer  vendor:publish --tag=gaze-ghostwriter-config
php artisan vendor:publish --tag=gaze-ghostwriter-migrations
php artisan migrate
bash
php artisan vendor:publish --tag=gaze-ghostwriter-views
php artisan vendor:publish --tag=gaze-ghostwriter-prompts
bash
php artisan ghostwriter:imap-test            # verify IMAP credentials, list folders
php artisan ghostwriter:reprocess-html-bodies # rebuild plain text from HTML bodies