PHP code example of mortezamasumi / fb-message

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

    

mortezamasumi / fb-message example snippets


// config/fb-message.php
return [
    'navigation' => [
        'model_label' => 'fb-message::fb-message.navigation.label',
        'plural_model_label' => 'fb-message::fb-message.navigation.plural_label',
        'group' => null,
        'parent_item' => null,
        'icon' => 'heroicon-o-envelope',
        'active_icon' => 'heroicon-s-envelope',
        'badge' => false,
        'badge_tooltip' => null,
        'sort' => 9999,
    ],
    'max_attachments' => env('MESSAGE_MAX_ATTACHMENTS', 5),
    'max_attachment_size' => env('MESSAGE_MAX_ATTACHMENT_SIZE', 8000),
    'attachment_disk' => env('MESSAGE_ATTACHMENT_DISK', 'public'),
    'attachment_folder' => env('MESSAGE_ATTACHMENT_FOLDER', '/uploads/attachments'),
    'attachment_visibility' => env('MESSAGE_ATTACHMENT_VISIBILITY', 'public'),
];

use Mortezamasumi\FbMessage\FbMessagePlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugin(FbMessagePlugin::make());
}

use Illuminate\Database\Eloquent\Builder;

public function scopeMessageTo(Builder $query): Builder
{
    return $query;
}

use Mortezamasumi\FbMessage\Facades\FbMessage;

FbMessage::markAsRead($message);   // mark as read for the current user
FbMessage::archive($message);      // move to the archived folder
FbMessage::unarchive($message);    // restore to inbox / sent
FbMessage::trash($message);        // move to the trash folder
FbMessage::restore($message);      // restore from trash
FbMessage::forget($message);       // detach the current user and delete when nobody references it
bash
php artisan vendor:publish --tag="fb-message-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="fb-message-config"