{{ $product->name }}
{{ number_format($product->price) }} KHR
View productBuild a Cambodian online shop for fashion, beauty products, electronics, groceries, or local crafts. Start with a small catalog and support English, Khmer, Cambodian riel, and cash on delivery.
Backend: PHP with Laravel
Frontend: Laravel Blade with Tailwind CSS, or React later
Database: MySQL
Authentication: Laravel starter kit
Version control: Git and GitHub
Register and log in
Browse products
Search and filter products
View product details
Add and remove cart items
Create an order
View order history
Admin product management
Cash-on-delivery checkout
composer create-project laravel/laravel cambodia-shop
cd cambodia-shop
php artisan key:generate
php artisan migrate
php artisan serve
Set the database values in .env:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=cambodia_shop
DB_USERNAME=root
DB_PASSWORD=
For authentication, install a Laravel starter kit suitable for your Laravel version. Follow the official Laravel authentication documentation and run its migrations.
cambodia-shop/
├── app/
│ ├── Http/Controllers/
│ └── Models/
├── database/
│ ├── migrations/
│ └── seeders/
├── resources/views/
│ ├── layouts/
│ ├── products/
│ ├── cart/
│ ├── orders/
│ └── admin/
├── routes/web.php
├── public/
└── README.md
id
name
password
role
id
name
description
price
image
category
stock
timestamps
id
user_id
total
delivery_address
payment_method
status
timestamps
id
order_id
product_id
quantity
price
timestamps
php artisan make:model Product -mcr
php artisan make:model Order -mcr
php artisan make:model OrderItem -m
php artisan make:seeder ProductSeeder
Example products migration:
Schema::create('products', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->text('description');
$table->decimal('price', 10, 2);
$table->string('image')->nullable();
$table->string('category');
$table->unsignedInteger('stock')->default(0);
$table->timestamps();
});
Run migrations:
php artisan migrate
// app/Models/Product.php
class Product extends Model
{
protected $fillable = [
'name', 'description', 'price', 'image', 'category', 'stock'
];
}
use App\Http\Controllers\ProductController;
use App\Http\Controllers\OrderController;
Route::get('/', [ProductController::class, 'index']);
Route::resource('products', ProductController::class)->only([
'index', 'show'
]);
Route::middleware('auth')->group(function () {
Route::get('/cart', [CartController::class, 'index'])->name('cart.index');
Route::post('/cart/{product}', [CartController::class, 'store'])->name('cart.store');
Route::post('/orders', [OrderController::class, 'store'])->name('orders.store');
Route::get('/orders', [OrderController::class, 'index'])->name('orders.index');
});
public function index(Request $request)
{
$products = Product::query()
->when($request->search, function ($query, $search) {
$query->where('name', 'like', "%{$search}%");
})
->latest()
->paginate(12);
return view('products.index', compact('products'));
}
@foreach ($products as $product)
{{ $product->name }}
{{ number_format($product->price) }} KHR
View product
@endforeach
{{ $products->links() }}
Configure MySQL and authentication.
Create migrations, models, and seed data.
Build the product listing and details pages.
Add search, categories, and pagination.
Build a session-based cart.
Create checkout and order tables.
Add order history.
Add admin product and order management.
Add Khmer and English labels and Cambodian delivery fields.
Test and deploy.
Use Laravel validation for every form.
Protect forms with CSRF tokens.
Use authorization policies for admin actions.
Hash passwords through Laravel authentication.
Recalculate order totals on the server.
Check stock before saving an order.
Keep secrets in .env.
Use eager loading where appropriate.
Khmer and English language switcher
Prices in KHR
Province and district delivery fields
Telegram order notifications
Product reviews
Order status tracking
Feature and unit tests
Live deployment
A user can register and log in.
Invalid input is rejected.
Products and images display correctly.
Search and pagination work.
Cart quantities update correctly.
Empty carts cannot be checked out.
Stock is checked during checkout.
Customers cannot access admin pages.
Orders appear in the correct account.
The site works on mobile.
# Cambodia Shop
A Laravel and MySQL e-commerce application for Cambodian customers.
## Features
## Technologies
## Screenshots
## Installation
## Environment variables
## Database setup
## Demo account
## Future improvements
Build the first version with fake products and cash on delivery. Add online payments only after the basic ordering flow works.