PHP code example of romverner / laravel-advanced-relationships
1. Go to this page and download the library: Download romverner/laravel-advanced-relationships 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/ */
romverner / laravel-advanced-relationships example snippets
namespace App;
use Illuminate\Database\Eloquent\Model;
class A extends Model
{
use \Reiff\AdvancedRelationships\HasAdvancedRelationships;
public function b()
{
return $this->hasMany('B', 'f1', 'details->l1');
}
public function c()
{
return $this->hasMany('C', ['f1', 'details->f2'], ['details->l1', 'l2']);
}
}