Closed ghost closed 8 years ago
ok, I found a way :D
Can you post it here, i'm stuck on the same thing ?
just wait, I'm too busy these days. I just thinking about it, now I'm coding it, I'll give my code to you later.
I think we have to so something like this :))
routes.php:
Route::post('/checkout', 'CheckoutController@checkout')->middleware('auth');
CheckoutController.php:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use Amsgames\LaravelShop\LaravelShop as Shop;
use App\Cart as Cart;
class CheckoutController extends Controller
{
public function __construct(){
Shop::setGateway('paypal');
}
public function checkout(Request $request){
$cart = Cart::current();
$success = Shop::checkout($cart);
//some code
}
}
Hi I'm new to Laravel, I'm able to create a site just add product to cart, remove product from cart. Now I want to make it can purchase, and I have no idea where to call Shop::setGateway('paypal'). Anyone can explain it to me or give me an example, thanks for help. p/s: sorry for my bad english.