PHP code example of inisiatif / model-shared

1. Go to this page and download the library: Download inisiatif/model-shared 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/ */

    

inisiatif / model-shared example snippets


use Inisiatif\ModelShared\Models\Donor;

Donor::resolveRelationUsing('branch', function (Donor $model) {
    // Sesuaikan branch model
    return $model->belongsTo(Branch::class, 'branch_id');
});

Donor::resolveRelationUsing('employee', function (Donor $model) {
    // Sesuaikan employee model
    return $model->belongsTo(Employee::class, 'employeeid');
});