Mercurius - Laravel 的 Messenger" style="max-width: 100%;">
mercurius是一個使用 Laravel 和 Vue.js 的即時訊息系統,具有完整的應用程序,您可以輕鬆地在任何 Laravel 專案中安裝它。
您可以嘗試mercurius的示範。使用下列任一憑證進行驗證:
密碼: password
提示:開啟2個不同的瀏覽器並使用不同的使用者名稱登錄,以便您可以測試傳送/接收訊息。
在繼續之前確保 Laravel 5.6
+ 已安裝。
如果您沒有帳戶,請在 Pusher.com 網站上建立免費帳戶。轉到儀表板,建立一個新應用程式並記下 API 憑證。
現在,讓我們將 API 金鑰新增到.env
檔案中。另外,將BROADCAST_DRIVER
更改為pusher
(預設為log
)。
. . .
BROADCAST_DRIVER =pusher
. . .
PUSHER_APP_ID ="xxxxxx"
PUSHER_APP_KEY ="xxxxxxxxxxxxxxxxxxxx"
PUSHER_APP_SECRET ="xxxxxxxxxxxxxxxxxxxx"
PUSHER_APP_CLUSTER ="xx"
BroadcastServiceProvider
開啟config/app.php
並取消註解行AppProvidersBroadcastServiceProvider::class,
。
如果身份驗證已設置,請跳過此步驟,否則鍵入:
php artisan make:auth
composer require launcher/ mercurius
如果要變更預設配置,請鍵入下列命令來發佈設定檔:
php artisan vendor:publish --tag= mercurius -config
若要編輯配置,請開啟/config/ mercurius .php
並新增您自己的值。
return [
/*
|--------------------------------------------------------------------------
| mercurius Models
|--------------------------------------------------------------------------
|
| Defines the models used with mercurius , use it to extend mercurius and
| create your own implementation.
|
*/
' models ' => [
' user ' => App User::class,
' messages ' => Launcher mercurius Models Message::class,
],
/*
|--------------------------------------------------------------------------
| User Table Fields
|--------------------------------------------------------------------------
|
| You can specify the column names for the user table. The `name` accepts
| an array of fields, for building custom names with multiple columns.
|
*/
' fields ' => [
// 'name' => ['first_name', 'last_name'],
' name ' => ' name ' ,
' slug ' => ' slug ' ,
' avatar ' => ' avatar ' ,
],
];
php artisan mercurius :install
composer dump-autoload
將Launcher mercurius mercurius User
特徵新增至您的User
模型:
// ...
use Illuminate Foundation Auth User as Authenticatable ;
use Launcher mercurius mercurius User ;
class User extends Authenticatable
{
use mercurius User;
// ...
}
php artisan db:seed --class= mercurius DatabaseSeeder
將向系統新增訊息和用戶,如演示範例所示:
演示用戶:
密碼: password
每當您更新mercurius時,請確保發布資源以套用新版本的 CSS/JS。
php artisan vendor:publish --tag= mercurius -public --force
請參閱定制以獲取更多資訊。
查看路線圖以獲取更多資訊。
請參閱貢獻以獲取更多資訊。
我們保留變更日誌,其中包含已變更的資訊。
版權所有 2018 布魯諾託林哈。 mercurius是根據 MIT 許可證發布的。