Created
December 21, 2019 19:43
-
-
Save x22element/1772027fe4998b08a89c4cb674c8c3ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use Carbon\Carbon; | |
use FreeKassa; | |
use Auth; | |
use App\Balance; | |
use Illuminate\Http\Request; | |
class BillingController extends Controller | |
{ | |
public function index() | |
{ | |
return view('billing.index'); | |
} | |
public function invoices() | |
{ | |
return view('billing.invoices'); | |
} | |
public function goPay(Request $request) | |
{ | |
$amount = $request->input('amount'); | |
$merch = $request->input('merch'); | |
Balance::create([ | |
'user_id' => Auth::user()->id, | |
'pay_id' => strtoupper(str_random(10)), | |
'money' => $amount, | |
'merchant' => $merch, | |
'status' => 'process', | |
]); | |
$b = Balance::where('user_id', Auth::user()->id)->first(); | |
$rows = [ | |
'time' => Carbon::now(), | |
'info' => 'Local payment' | |
]; | |
$url = FreeKassa::getPayUrl($b->money, $b->pay_id, Auth::user()->email, $rows); | |
$redirect = FreeKassa::redirectToPayUrl($b->money, $b->pay_id, Auth::user()->email, $rows); | |
return $redirect; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment