【发布时间】:2017-06-15 11:03:15
【问题描述】:
错误是:
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.
*/
}
}
【问题讨论】:
标签: laravel