PHP code example of henrotaym / laravel-trustup-messaging-io

1. Go to this page and download the library: Download henrotaym/laravel-trustup-messaging-io 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/ */

    

henrotaym / laravel-trustup-messaging-io example snippets


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,
        ]);
    }
}

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;
}

use Henrotaym\LaravelTrustupMessagingIo\Http\Resources\MessagingIoModel;
use Illuminate\Http\Request;

class MyResource extends MessagingIoModel
{
    protected function getAttributes(Request $request): array
    {
        // Define your attributes here.
    }
}