henrotaym/laravel-trustup-messaging-io
最新稳定版本:v2.0.1
Composer 安装命令:
composer require henrotaym/laravel-trustup-messaging-io
包简介
Basic versioned php package.
README 文档
README
Compatibility
| Laravel | Package |
|---|---|
| 8.x / 9.x | 1.x |
| 12.x | 2.x |
Installation
composer require henrotaym/laravel-trustup-messaging-io
.env configuration
Add these information to your .env file.
TRUSTUP_MESSAGING_API_URL= TRUSTUP_MESSAGING_APP_KEY=
Preparing your models morph type (optional).
Define your morph types in an service provider like AppServiceProvider for example.
use App\Models\YourModel; use Illuminate\Support\ServiceProvider; use Illuminate\Database\Eloquent\Relations\Relation; class AppServiceProvider extends ServiceProvider { /** * Register any application services. * * @return void */ public function register() { Relation::enforceMorphMap([ 'your-model' => YourModel::class, ]); } }
Preparing your models
Your model should look like this
use Henrotaym\LaravelTrustupMessagingIo\Contracts\Models\MessagingIoModelContract; use Henrotaym\LaravelTrustupMessagingIo\Models\Traits\IsMessagingIoModel; use Illuminate\Database\Eloquent\Model; class MyModel extends Model implements MessagingIoModelContract { use IsMessagingIoModel; }
Exposing your model
Your resource exposing your model shoud look like this
use Henrotaym\LaravelTrustupMessagingIo\Http\Resources\MessagingIoModel; use Illuminate\Http\Request; class MyResource extends MessagingIoModel { protected function getAttributes(Request $request): array { // Define your attributes here. } }
Your resource will automatically have trustup_io_messaging key containing values required to use Vue messaging package
统计信息
- 总下载量: 2.31k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-09-24