错误是:
PaymentController.php第46行中的FatalErrorException: 语法错误,意外“公共”(T_PUBLIC)
当我尝试加载页面时,会显示此错误。我真的不知道这里有什么问题:
PaymentController:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use Tzsk\Payu\Facade\Payment;
class PaymentController extends Controller
{
public function pay() {
/**
* These are the minimum required fieldset.
*/
$data = [
'txnid' => strtoupper(str_random(8)), # Transaction ID.
'amount' => rand(100, 999), # Amount to be charged.
'productinfo' => "Product Information",
'firstname' => "user", # Payee Name.
'email' => "user@gmail.com", # Payee Email Address.
'phone' => "9876543210", # Payee Phone Number.
# Additional Fields With Data if any.
# Optional Fields With Data if any.
];
return Payment::make($data, function ($then) {
//$then->redirectTo('/payment/status');
# OR...
//$then->redirectRoute('payment_status');
# OR...
$then->redirectAction('PaymentController@status');
/**
* Above are general Redirect::to(), Redirect::route() and Redirect::action() Methods.
* You can use them as you normally would (With Parameters if you like) in any place to redirect.
*
* Note: You have to return the Payment Facade.
*/
});
}
}
public function status() {
$payment = Payment::capture(); # capture the payment after it's done. That's it.
/**
* $payment is the Model instance of payu_payment row.
*/
}
}
答案 0 :(得分:2)
你有两个结束花括号而不是一个:
}
}
从pay()
方法中删除其中一个。