我的Laravel代码出错了。
它显示了这个
传递给Order \ Order :: __ construct()的参数1必须是System \ RewardPoint的一个实例,没有给出,在C:\ xampp \ htdocs \ stardibs-version2 \ stardibs-v2 \ vendor \ laravel \ framework \中调用第647行的src \ Illuminate \ Database \ Eloquent \ Model.php并定义了
order.php
use BaseModel, DB;
use Eloquent, User\User, Auth, Cart, Order\Order;
use System\RewardPoint as RewardPoint;
class Order extends BaseModel {
public function __construct(RewardPoint $rewardPoint)
{
$this->rewardPoint = $rewardPoint;
}
}
这是什么解决方案?
答案 0 :(得分:1)
创建类Order的目标时,需要将对象RewardPoint传递给它的构造函数:
$rewardPoint = new RewardPoint(/** whatever arguments are needed **/);
$order = new Order($rewardPoint);