E-commerce Product Catalog with Laravel
Build an online shop catalog with Laravel: customers browse products by category with pagination, search by name and description, view a product's page, and add products to a shopping cart that remembers its contents in the session, where quantities can be changed and items removed, with totals calculated on the server. Data lives in MySQL through Eloquent models with relationships, pages are Blade templates built from reusable components, and the main flows are covered by feature tests. You'll learn Laravel's MVC structure, migrations and seeders with factories, Eloquent relationships and query scopes, pagination, session-based carts, validation, Blade components, and feature testing.
- Estimate
- ~11.5h
- Steps
- 6
- Completed by
- 0
- Proposed by
- codeseed.app
Laravel · Eloquent · Blade
Project roadmap
- 01
Set up the project and models
~2hCreate a Laravel project connected to MySQL (for example with Laravel Sail or a local MySQL). Create Category and Product models with migrations (products have a name, slug unique, description, price stored as an integer in cents, stock, an active flag and a category) and relationships (belongsTo and hasMany). Write factories and a seeder creating 8 categories and 150 products. Done when: php artisan migrate --seed creates and fills the tables.
- 02
Browse the catalog
~2hCreate routes and controllers for the home page (featured products and categories), a category page listing its active products with pagination (paginate(12)) and sorting by name or price, and a product page found by slug (404 for inactive or unknown products). Use eager loading (with('category')) to avoid one query per product. Done when: every page shows the right products, and paging and sorting work.
- 03
Add search
~1.5hAdd a search form in the header and a local query scope (scopeSearch) on Product that matches the name or description, combined with optional filters for category and a price range. Validate the search input, keep the search terms in pagination links (withQueryString), and show a helpful message when nothing matches. Done when: searching and filtering return the right products across pages.
- 04
Build the cart
~2.5hCreate a Cart service that stores product ids and quantities in the session, with add, update, remove and clear, and calculates line totals and the cart total from current database prices (never trusting prices sent from the page). Validate quantities (at least 1 and not more than the stock), and handle products that became inactive by removing them with a message. Build a cart page and show the item count in the header. Done when: products can be added, changed and removed, and totals are always correct.
- 05
Polish the pages
~1.5hCreate Blade components for the product card, price display (formatting cents as money), and flash messages, and a layout with navigation. Style the pages (for example with Tailwind, which Laravel supports out of the box) so they work well on phones. Protect forms with CSRF tokens (automatic in Blade forms). Done when: the shop looks consistent and works on small screens.
- 06
Write feature tests
~2hWrite feature tests with a test database (RefreshDatabase): browsing categories and pagination, product pages and 404s, search and filters, adding to the cart, quantity limits, removing items, and totals calculated from database prices. Done when: php artisan test passes.
Resources
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack