我有私人和公共职能。私有函数获取从表单发送的数据,公共函数执行结帐。
private function projectData(Request $request){
// dd($request->all());
// $item = [];
// $datat = array_map(function($item){
// return [
// 'name'=>$request->project_id,
// 'price'=>$request->budget,
// 'desc'=>'Deposit',
// 'qty'=>1
// ];
// }, $item);
$data = [
'items'=>[
'name'=>'Project No.'.$request->project_id
],
'invoice_id' => uniqid(),
'invoice_description' => "Payment for Project No.".$request->project_id." Amount ".$request->budget,
'return_url' => route('payment.success'),
'cancel_url' => route('payment.cancel'),
'total' => $request->budget
];
// dd($data);
return $data;
}
/**
* Responds with a welcome message with instructions
*
* @return \Illuminate\Http\Response
*/
public function payment() {
$data = $this->projectData();
$provider = new ExpressCheckout;
$response = $provider->setExpressCheckout($data);
dd($response);
// $response = $provider->setExpressCheckout($data, true);
return redirect($response['paypal_link']);
}
我收到这个错误
函数 App\Http\Controllers\PayPalController::projectData() 的参数太少,第 42 行 /var/www/CareerHouse/app/Http/Controllers/PayPalController.php 中传入的参数为 0,而预期为 1
我不知道我做错了什么以及如何纠正?
慕无忌1623718
万千封印