Overview
The Flash Deals feature allows you to create time-limited promotional offers that appear on your homepage with countdown timers. Flash deals can showcase products with special discounts, creating urgency and driving sales.Flash deals support multi-language translations and can be featured prominently on your homepage with custom styling.
Database Structure
FlashDeal Model
Location:app/Models/FlashDeal.php:1
Relationships:
flash_deal_translations()- HasMany relationship for multi-language support (app/Models/FlashDeal.php:18)flash_deal_products()- HasMany relationship with products (app/Models/FlashDeal.php:22)
title- Flash deal namestart_date- Unix timestamp for deal startend_date- Unix timestamp for deal expirationbackground_color- Custom background colortext_color- Custom text colorbanner- Banner image pathstatus- Active (1) or Inactive (0)featured- Display on homepage (1) or not (0)slug- URL-friendly identifier
FlashDealProduct Model
Location:app/Models/FlashDealProduct.php:1
Fillable Fields:
flash_deal_id- Reference to flash dealproduct_id- Reference to product
product()- BelongsTo relationship (app/Models/FlashDealProduct.php:11)
Creating Flash Deals
Create New Deal
Click “Add New Flash Deal” and fill in the required information:
- Title
- Date Range (Start/End dates)
- Background Color
- Text Color
- Banner image (optional)
Add Products
Select products to include in the flash deal. For each product:
- Choose the discount amount
- Select discount type (percentage or fixed amount)
Display Requirements
For a flash deal to appear on the homepage, it must meet ALL of these conditions:status = 1(Active)featured = 1(Featured)start_date ≤ current time(Already started)end_date ≥ current time(Not expired)- At least one product in
flash_deal_productstable
isActiveAndFeatured scope for filtering (app/Models/FlashDeal.php:27-31):
Frontend Features
Display Components
The flash deals card includes:- Product carousel with navigation buttons
- Price display with discount percentage badges
- Countdown timer showing Days, Hours, Minutes, Seconds
- Product ratings from database
- Custom styling with configurable colors
Helper Functions
Location:app/Http/Helpers.php
get_featured_flash_deal()
- Retrieves the currently active featured flash deal
- Gets all products associated with a specific flash deal
Permissions
The following permissions control access to flash deal features (app/Http/Controllers/FlashDealController.php:14-21):view_all_flash_deals- View flash deals listadd_flash_deal- Create new flash dealsedit_flash_deal- Modify existing flash dealsdelete_flash_deal- Remove flash dealspublish_flash_deal- Toggle featured status
API Endpoints
List Flash Deals
Update Status
Update Featured
Customization
Styling
Default brand colors:- Product names:
#0961b3(blue) - Prices:
#a90000(red) - Stars:
#ffc107(gold) - Discount badge:
#e74c3c(red background)
Translation Support
Flash deals support multi-language content through theFlashDealTranslation model:
Troubleshooting
Flash Deal Not Showing
Products Not Displaying
-
Check products exist in junction table:
- Verify products are published and accessible
- Check browser console for JavaScript errors
- Confirm discount type is set correctly in the product record