public function thanks(Request $request) { $secret_key = env('CITRUSGATEWAY_SECRETKEY'); $data = ''; $flag = true; $fields = ['TxId', 'TxStatus', 'amount', 'pgTxnNo', 'issuerRefNo', 'authIdCode', 'firstName', 'lastName', 'pgRespCode', 'addressZip']; $fill_data = []; foreach ($fields as $field) { if ($request->has($field)) { $data .= $request->get($field); } $fill_data[$field] = $request->get($field, ''); } Pay::create($fill_data); $signature = $request->get('signature', ''); $txnID = $request->get('TxId', ''); $txnStatus = $request->get('TxStatus', ''); $response_signature = hash_hmac('sha1', $data, $secret_key); if ($signature != '' && strcmp($signature, $response_signature) != 0) { $flag = false; } return view('thanks', compact('flag', 'txnID', 'txnStatus')); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(PayRequest $request) { $data = ['name' => $request->get('name')]; Pay::create($data); return redirect()->route('pay.index'); }
/** * Run the database seeds. * * @return void */ public function run() { $faker = Faker\Factory::create(); for ($i = 0; $i < 10; ++$i) { Pay::create(['name' => $faker->name]); } }