This is a Laravel 11-based web application designed to manage areas by handling three main entities: Country, State, and City. It provides a secure and user-friendly authentication system with real-time input validation using AJAX, enhancing user experience and utilizing modern web development practices.
- Secure Login & Registration using Laravel Breeze, enhanced with AJAX for real-time form validation.
- Password Reset functionality to help users recover their accounts securely.
- Built-in Session Management and protections against common security vulnerabilities such as CSRF, XSS, and SQL Injection.
-
Country Management:
- Create, Read, Update, and Delete countries.
- Each country can have multiple states.
-
State Management:
- Create, Read, Update, and Delete states.
- Each state belongs to a specific country and can have multiple cities.
-
City Management:
- Create, Read, Update, and Delete cities.
- Each city is tied to a state.
- BelongsTo Relationship:
- A State belongs to a Country.
- A City belongs to a State.
- One-to-Many Relationship:
- A Country can have multiple States.
- A State can have multiple Cities.
- SQL queries are optimized for performance to ensure a smooth experience.
- Built with Bootstrap for a clean and responsive design that adapts seamlessly to all devices.
- AJAX-powered CRUD operations to provide a fluid, page-less interaction experience, making the app feel fast and responsive.
-
Clone the repository:
git clone https://github.com/ahmad-cit22/area-management-app.git cd area-management-app
-
Install dependencies:
composer install npm install
-
Set up your environment: Copy the
.env.example
file to.env
:cp .env.example .env
Generate the application key:
php artisan key:generate
-
Configure your database: Update the
.env
file with your database details:DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=area_management DB_USERNAME=your_username DB_PASSWORD=your_password
-
Run migrations and seed the database:
php artisan migrate --seed
-
Start the development server:
php artisan serve
-
Compile front-end assets:
npm run dev
This application uses Pest for testing, a delightful PHP testing framework that helps you write clear and expressive tests.
Before running the tests, ensure your environment is correctly configured:
-
Ensure Pest is Installed:
If Pest is not installed in your project yet, you can add it via Composer:composer require pestphp/pest --dev
-
Initialize Pest:
After installation, initialize Pest in your project:php artisan pest:install
-
Create the
.env.testing
File:
In the root directory of your project, create a.env.testing
file with the following content:APP_ENV=testing APP_KEY=base64:+EhHUCsv8cRrKva+QijNRmA7bf7Uk1FkBht5i1r0LdA= LOG_CHANNEL=stack LOG_LEVEL=debug DB_CONNECTION=sqlite DB_DATABASE=:memory: CACHE_DRIVER=array QUEUE_CONNECTION=sync SESSION_DRIVER=array MAIL_MAILER=log
-
Generate the Application Key:
If you haven't generated an application key yet, you can do so for your testing environment with:php artisan key:generate --env=testing
Once your environment is set up, you can run the test suite using the following command:
php artisan test
This will run all of the application's test cases, including those for authentication and CRUD operations.
The test suite covers the following:
- Login View: Ensures the login page is accessible.
- Login Functionality: Tests if users can log in with valid credentials.
- Logout: Verifies the logout functionality works correctly.
- Registration: Ensures users can register for a new account.
- Real-time Validation: Tests real-time input validation for name, email, username and password fields.
-
Country CRUD Operations:
- Listing all countries.
- Storing a new country.
- Editing and updating existing country details.
- Deleting a country.
-
State CRUD Operations:
- Listing all states.
- Storing a new state.
- Editing and updating state details.
- Deleting a state.
-
City CRUD Operations:
- Listing all cities.
- Storing a new city.
- Editing and updating city details.
- Deleting a city.
We welcome contributions to improve this project! If you want to contribute:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes.
- Push your branch to your forked repository.
- Open a pull request with a description of the changes.
Please ensure your code passes all tests before submitting your pull request.
We hope you enjoy using the Area Management CRUD Application! If you encounter any issues or have any suggestions, feel free to open an issue or contribute to the project. Happy coding! 🚀