Corcel\Model::hasMany PHP Méthode

hasMany() public méthode

Replace the original hasMany function to forward the connection name
public hasMany ( string $related, null $foreignKey = null, null $localKey = null ) : Illuminate\Database\Eloquent\Relations\HasMany
$related string
$foreignKey null
$localKey null
Résultat Illuminate\Database\Eloquent\Relations\HasMany
    public function hasMany($related, $foreignKey = null, $localKey = null)
    {
        $foreignKey = $foreignKey ?: $this->getForeignKey();
        $instance = new $related();
        if ($instance instanceof Model) {
            $instance->setConnection($this->getConnection()->getName());
        } else {
            $instance->setConnection($instance->getConnection()->getName());
        }
        $localKey = $localKey ?: $this->getKeyName();
        return new HasMany($instance->newQuery(), $this, $foreignKey, $localKey);
    }