This is a Laravel-based e-commerce platform, built using Filament for an intuitive admin dashboard. The platform allows for product management, order handling, and more.
- Product Management: Manage products, categories, and stock.
- Order Management: Track and manage customer orders with statuses.
- User Roles: Role-based access control to the Filament dashboard.
- Image Uploads: Upload and manage product images with previews.
- Dynamic Slug Generation: Automatic slugs for categories and products.
- Relational Data: Order details with multiple products and quantities per order.
- PHP >= 8.1
- Composer
- Node.js and npm (for frontend assets)
- MySQL or another supported database
- Laravel 11
- Filament (latest version)
Follow these steps to set up and run the project on your local machine.
git clone https://github.com/mhdthariq/SnackStore.git
cd SnackStoreInstall the PHP dependencies with Composer:
composer installInstall the JavaScript dependencies:
npm installCreate a .env file by copying the example:
cp .env.example .envGenerate an application key for encryption:
php artisan key:generateOpen the .env file and configure your database settings:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database_name
DB_USERNAME=your_username
DB_PASSWORD=your_passwordRun migrations to create database tables, and optionally seed the database with example data.
php artisan migrate
php artisan db:seedCreate a symbolic link from public/storage to storage/app/public for image uploads.
php artisan storage:linkCompile the frontend assets using:
npm run devFor production, use:
npm run buildRun the Laravel development server:
php artisan serveVisit http://localhost:8000 in your browser. To access the Filament dashboard, go to http://localhost:8000/admin and log in with your admin credentials.
Images are stored in storage/app/public/products_images. Ensure your .env file includes the correct FILESYSTEM_DISK setting:
FILESYSTEM_DISK=publicIf you encounter CORS issues, make sure your .htaccess file is correctly configured to allow access to images.
If you need unique IDs for orders, update the Order model as shown below:
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
$model->id = uniqid('order_');
});
}- Route not found errors: Run
php artisan route:clearandphp artisan cache:clear. - CORS issues: Configure your
.htaccessfor image access if using Apache, or configure your CORS policy in Laravel if using other servers.