1. Go to this page and download the library: Download artoodetoo/compoships 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/ */
artoodetoo / compoships example snippets
namespace App;
use Illuminate\Database\Eloquent\Model;
class Foo extends Model
{
public function bars()
{
//WON'T WORK WITH EAGER LOADING!!!
return $this->hasMany('Bar', 'f1', 'f1')->where('f2', $this->f2);
}
}
namespace App;
use Illuminate\Database\Eloquent\Model;
class A extends Model
{
use \Awobaz\Compoships\Compoships;
public function b()
{
return $this->hasMany('B', ['f1', 'f2'], ['f1', 'f2']);
}
}
namespace App;
use Illuminate\Database\Eloquent\Model;
class B extends Model
{
use \Awobaz\Compoships\Compoships;
public function a()
{
return $this->belongsTo('A', ['f1', 'f2'], ['f1', 'f2']);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.