22 lines
565 B
PHP
22 lines
565 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
class CheckoutController extends Controller
|
|
{
|
|
/**
|
|
* Menampilkan halaman checkout.
|
|
* Mengecek apakah user punya item di keranjang sebelum masuk ke sini.
|
|
*/
|
|
public function index()
|
|
{
|
|
$cart = session()->get('cart');
|
|
if (!$cart || count($cart) == 0) {
|
|
return redirect()->route('shop')->with('error', 'Keranjang Anda kosong, silahkan belanja produk terlebih dahulu.');
|
|
}
|
|
|
|
return view('landing.checkout', compact('cart'));
|
|
}
|
|
} |