PHP code example of pendalff / eloquent-joins
1. Go to this page and download the library: Download pendalff/eloquent-joins 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/ */
pendalff / eloquent-joins example snippets
namespace App;
use EloquentJoins\ModelTrait as EloquentJoinsModelTrait;
class User
{
use EloquentJoinsModelTrait;
protected $table = 'users';
public function orders()
{
return $this->hasMany('\App\Order');
}
}
$users = User::join('orders')->get();