Hello i use cold storage i dont want use RPC because so many memory needed,but i need use manual.How can i get different address when data will be submit,When user fill data controller will redirect to pay and pay will get different address every submit data in cart list.Example when user fill again and user will get different address.When address reach 24 hour dont have balance data will be revert zero in 'in_use' column.Can you help me because many time i dont wills show same address every data submit https://pastebin.com/6tB1HtGM
//wallet table
Schema::create('wallets', function (Blueprint $table) {
$table->id();
$table->boolean('in_use')->default(false);
$table->string('address');
$table->timestamps();
});
//product controller
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Product;
use Darryldecode\Cart\CartCondition;
use App\Customer;
use App\Http\Requests\BuyRequest;
use App\Http\Requests\ProductRequest;
use App\Wallet;
class ProductController extends Controller
{
//
public function index(){
// $products = Product::all();
// return dd($products);
}
public function showpage(){
$dataproducts = Product::all();
return view('index.homeshop',compact('dataproducts'));
}
public function addtocart(ProductRequest $request){
$cart = \Cart::add(array(
'id' => $request->input('id'),
'name' => $request->input('name'),
'price' => $request->input('price'),
'quantity' => $request->input('quantity'),
));
return back();
}
public function updatetocart(Request $request){
// $cartupdate = \Cart::
return back();
}
public function deletetocart(){
}
public function checkout(Request $request){
$items = \Cart::getContent();
return view('index.wishlist',compact('cartcontent'));
}
public function buyprocess(BuyRequest $request){
$customer = new Customer();
$customer->wallet_id = Wallet::where('is_use',0)->first();
$customer->firstname = $request->input('firstname');
$customer->lastname = $request->input('lastname');
$customer->email = $request->input('email');
$customer->address = $request->input('address');
$customer->address2 = $request->input('address2');
$customer->postcode = $request->input('postcode');
$customer->city = $request->input('city');
$customer->state = $request->input('state');
$customer->country = $request->input('country');
$customer->save();
return redirect('pay');
}
}
//wallet controller
<?php
namespace App\Http\Controllers;
use App\MemberCustomer;
use App\Customer;
use App\Product;
use Illuminate\Http\Request;
use Darryldecode\Cart\CartCondition;
use SimpleSoftwareIO\QrCode\Generator;
use Illuminate\Support\Str;
use App\Wallet;
class WalletController extends Controller
{
//
public function getwallet(Request $request){
if(\Cart::getSubTotal() == true){
$wallet = Wallet::where('is_use',0)->first();
//if wallet has been use put 1
return view('index.payment',compact('wallet'));
}
else{
echo 'not allowed,Please add some product';
}
}
}
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2BF3AMQ
via IFTTT
Aucun commentaire:
Enregistrer un commentaire