Skip to content

BigSt3pper/smart_parking_system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

24 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

ParkSmart - Smart Parking Management System

A modern parking reservation system built with Laravel. Users can book parking slots, track time in real-time, and pay on exit.


๐Ÿš€ Features

User Features

  • โœ… User registration and authentication
  • โœ… Browse 100 parking slots organized by floors (Ground Floor to 4th Floor)
  • โœ… Real-time slot availability
  • โœ… Book parking slots instantly
  • โœ… Real-time timer and cost calculator
  • โœ… Pay-on-exit system
  • โœ… View booking history
  • โœ… Beautiful responsive UI with purple gradient theme

Admin Features (To be implemented)

  • ๐Ÿ”ง Admin dashboard
  • ๐Ÿ”ง Manage parking slots
  • ๐Ÿ”ง View all reservations
  • ๐Ÿ”ง Generate reports

๐Ÿ“‹ Prerequisites

Before you begin, make sure you have installed:

  • PHP 8.1 or higher
  • Composer
  • SQLite (comes with PHP)
  • Node.js & NPM (optional, for asset compilation)

๐Ÿ› ๏ธ Installation & Setup

1. Clone the Repository

git clone <your-repo-url>
cd parksmart

2. Install Dependencies

composer install

3. Environment Setup

Copy the example environment file:

cp .env.example .env

Generate application key:

php artisan key:generate

4. Database Setup

The project uses SQLite. The database file should already exist at database/database.sqlite.

If it doesn't exist, create it:

touch database/database.sqlite

Run migrations:

php artisan migrate

5. Seed Parking Slots

Open Laravel Tinker:

php artisan tinker

Create 100 parking slots (5 floors, 20 slots each):

$floors = [
    ['name' => 'Ground Floor', 'prefix' => 'GF', 'price' => 200],
    ['name' => '1st Floor', 'prefix' => '1F', 'price' => 150],
    ['name' => '2nd Floor', 'prefix' => '2F', 'price' => 120],
    ['name' => '3rd Floor', 'prefix' => '3F', 'price' => 100],
    ['name' => '4th Floor', 'prefix' => '4F', 'price' => 80],
];

foreach ($floors as $floor) {
    for ($i = 1; $i <= 20; $i++) {
        \App\Models\ParkingSlot::create([
            'slotNumber' => $floor['prefix'] . '-' . str_pad($i, 2, '0', STR_PAD_LEFT),
            'location' => $floor['name'],
            'status' => 'Available',
            'pricePerHour' => $floor['price']
        ]);
    }
}

echo "Created 100 parking slots!";

Verify slots were created:

\App\Models\ParkingSlot::count();  // Should return 100

Type exit to leave Tinker.

6. Create Admin Account

Open Tinker again:

php artisan tinker

Create an admin user:

\DB::table('User')->insert([
    'fullName' => 'Admin User',
    'email' => 'admin@parksmart.com',
    'password' => bcrypt('admin123'),
    'phoneNumber' => '0712345678',
    'role' => 'admin',
    'dateRegistered' => now()
]);

Verify admin was created:

\DB::table('User')->where('email', 'admin@parksmart.com')->first();

Type exit to leave Tinker.

7. Start the Application

php artisan serve

The application will be available at: http://127.0.0.1:8000


๐ŸŽฏ Usage

For Regular Users:

  1. Visit the landing page: http://127.0.0.1:8000
  2. Register: Click "Get Started (Register)"
  3. Login: Use your credentials
  4. View Slots: Click "View Slots" from the dashboard
  5. Book a Slot: Choose a slot and click "Book Now"
  6. Track Your Booking: Go to "My Reservations" to see real-time timer and cost
  7. End & Pay: Click "End Reservation & Pay" when done parking

For Admin:

  1. Admin Login: http://127.0.0.1:8000/admin/login
  2. Credentials:
    • Email: admin@parksmart.com
    • Password: admin123
  3. Admin Dashboard: (To be implemented by team member)

๐Ÿ“ Project Structure

parksmart/
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ Http/Controllers/
โ”‚   โ”‚   โ”œโ”€โ”€ Admin/          # Admin controllers
โ”‚   โ”‚   โ””โ”€โ”€ User/           # User controllers
โ”‚   โ””โ”€โ”€ Models/             # Eloquent models
โ”œโ”€โ”€ database/
โ”‚   โ”œโ”€โ”€ migrations/         # Database migrations
โ”‚   โ””โ”€โ”€ database.sqlite     # SQLite database file
โ”œโ”€โ”€ resources/
โ”‚   โ””โ”€โ”€ views/
โ”‚       โ”œโ”€โ”€ admin/          # Admin views
โ”‚       โ”œโ”€โ”€ auth/           # Authentication views
โ”‚       โ””โ”€โ”€ user/           # User views
โ”œโ”€โ”€ routes/
โ”‚   โ””โ”€โ”€ web.php            # Web routes
โ””โ”€โ”€ public/                # Public assets

๐Ÿ—„๏ธ Database Schema

Key Tables:

  • User - User accounts (both regular users and admins)
  • parking_slots - Parking slot information
  • Reservation - User bookings and reservations
  • Payment - Payment records
  • Vehicle - User vehicle information

๐Ÿ”ง Key Routes

Public Routes:

  • / - Landing page
  • /login - User login
  • /register - User registration

User Routes (Authenticated):

  • /dashboard - User dashboard
  • /slots - View available parking slots
  • /my-reservations - View user's bookings
  • /slots/{id}/book - Book a specific slot

Admin Routes:

  • /admin/login - Admin login
  • /admin/dashboard - Admin dashboard (to be implemented)

๐ŸŽจ UI/UX Features

  • Modern purple gradient theme
  • Responsive design (mobile-friendly)
  • Real-time timer (updates every second)
  • Real-time cost calculator
  • Smooth animations and transitions
  • Organized by floor tabs
  • Color-coded status badges

๐Ÿ› Troubleshooting

Issue: "No slots available"

Solution: Run the Tinker command to create slots (Step 5)

Issue: "Admin access required"

Solution: Make sure you created the admin account with role = 'admin' (Step 6)

Issue: "Slot stays occupied after payment"

Solution: Clear cache with php artisan cache:clear and try again

Issue: Database errors

Solution:

php artisan migrate:fresh

Then re-run Steps 5 & 6 to recreate slots and admin


๐Ÿ‘ฅ Team Roles

  • Member 1: User-side functionality (Completed โœ…)

    • Authentication
    • Booking system
    • Real-time timer & payment
    • UI/UX design
  • Member 2: Admin dashboard (Pending ๐Ÿ”ง)

    • Slot management
    • User management
    • Reservation overview
    • Reports & analytics

๐Ÿ“ Important Notes

  1. Database: The project uses SQLite. The database.sqlite file is NOT pushed to GitHub. Each team member needs to run migrations and seeders.

  2. Environment: The .env file is NOT in GitHub. Copy from .env.example and configure.

  3. Admin Password: Change the default admin password in production!

  4. Payment: Currently simulated (no real payment gateway). Click "Complete Payment" to mark as paid.

  5. Foreign Keys: Some foreign key constraints were removed for flexibility during development.


๐Ÿšง To-Do (For Next Team Member)

Admin Dashboard Features:

  • View all parking slots with status
  • Add/Edit/Delete parking slots
  • View all active reservations
  • View completed reservations with payment status
  • View all registered users
  • Generate revenue reports
  • Dashboard with statistics (total revenue, occupancy rate, etc.)
  • Search and filter functionality

Admin Dashboard UI:

  • Modern admin theme (match user-side purple theme)
  • Responsive tables
  • Charts/graphs for analytics
  • Quick stats cards

๐Ÿ’ก Tips for Admin Dashboard Developer

  1. Models already exist: Check app/Models/ for ParkingSlot, Reservation, User, etc.

  2. Use existing controllers: app/Http/Controllers/Admin/ has some scaffolding

  3. Routes are set up: Check routes/web.php for admin routes

  4. Database structure:

    • parking_slots table (primary key: id)
    • Reservation table (primary key: reservationID)
    • User table (primary key: userID)
  5. Key relationships:

    • Reservation belongs to User
    • Reservation belongs to ParkingSlot
    • User has many Reservations

๐Ÿ“ž Need Help?

If you encounter issues:

  1. Check the Troubleshooting section
  2. Clear cache: php artisan cache:clear
  3. Check Laravel logs: storage/logs/laravel.log
  4. Contact team members

๐Ÿ“„ License

This project is for educational purposes (Group Project).


Happy Coding! ๐Ÿš€

About

Laravel- based Smart Parking Management System

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

โšก