Yii
public function getOrders()
{
return $this->hasMany(Order::class, ['customer_id' => 'id']);
}
Laravel
public function orders()
{
return $this->hasMany(Order::class, 'customer_id', 'id');
}
到目前来看,yii 代码整洁度和易读性比Laravel是差了很多
public function getOrders()
{
return $this->hasMany(Order::class, ['customer_id' => 'id']);
}
Laravel
public function orders()
{
return $this->hasMany(Order::class, 'customer_id', 'id');
}
到目前来看,yii 代码整洁度和易读性比Laravel是差了很多
2017-01-17
用类的反射
$orders = $customer->hasMany(Order::class, ['customer_id' => 'id'])->asArray()->all();
$orders = $customer->hasMany(Order::class, ['customer_id' => 'id'])->asArray()->all();
2017-01-17
The OpenSSL PHP extension is not installed.,请在php.ini取消extension=php_openssl.dll前面的分号。
2017-01-12