PHP code example of kamicloud / laravel-unofficial-relations

1. Go to this page and download the library: Download kamicloud/laravel-unofficial-relations 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/ */

    

kamicloud / laravel-unofficial-relations example snippets

`
* Can load relation by id array or string
*
* @param $related
* @param string|null $foreignKey Format id1, id2 | array<id>
* @param string|null $relatedKey
* @param string|callable $delimiter Default ',', allows customize function or null(for array foreignKey)
`
* Can load morphTo with customize map
*
* @param  string  $name
* @param  string  $type Same as MorphTo
* @param  string  $id Same as MorphTo
* @param  string  $ownerKey Same as MorphTo
* @param  array|null $map [Morph type key name in DB => Model namespace]
`
* Can load morphTo with customize map and id can be a set
*
* @param  string  $name
* @param  string  $type Same as MorphTo
* @param  string  $id Same as MorphTo
* @param  string  $ownerKey Same as MorphTo
* @param  array|null $map Same as HasMorphToByMapRelation
* @param  string|callable $delimiter Same as HasManyBySetRelationship