This is a simple Laravel application for managing a car inventory. It allows you to add, delete, list, and update cars, and also manage available colors. This README provides instructions on setting up and running the application.
- PHP (>= 8.1)
- Composer
- Laravel (>= 10.0)
- Database (e.g., MySQL, PostgreSQL, SQLite)
- Clone the repository to your local machine:
git clone https://github.com/Timmsy1998/drivvn-tech-test.git
cd drivvn-tech-test
- Install PHP Dependencies using Composer:
composer install
- Configure your
.env
file. You can copy the example file and modify it as needed:
cp .env.example .env
Update your database connection settings in the .env
file.
- Generate an application key:
php artisan key:generate
- Run database migrations to create the necessary tables:
php artisan migrate
- Seed the database with sample colour information:
php artisan db:seed
- Start the development server:
php artisan serve
The Application will be accessible at http://localhost:8000
.
Personally, I used XAMPP to run this locally on my machine.
There are other methods available, but this is just my personal preference
- Adding a Car: Use the API endpoint
POST /api/cars
to add a new car to the inventory. Provide the car's details in the request payload. - Retrieving a Car: Use
GET /api/cars/{id}
to retrieve a specific car by its ID. - Deleting a Car: Use
DELETE /api/cars/{id}
to delete a car by its ID. - Listing All Cars: Use
GET /api/cars
to list all cars in the inventory.
- Adding, Updating, Deleting, and Listing Colors: These operations are also supported through respective API endpoints.
Enhancing the design of our car inventory application with additional data models brings several notable benefits:
-
Manufacturer Model: Create a
Manufacturer
model to represent car manufacturers, providing better categorization and detailed information about car makers. -
User Model: If you plan to introduce user-specific features, consider creating a
User
model to manage user accounts and their associations with cars. -
Features Model: Track additional features or specifications of cars by implementing a
Feature
model, which allows for more detailed information about each vehicle. -
# Model: Efficiently manage # data for cars, including price history and discounts, using a
#
model, enabling more sophisticated # strategies. -
Images Model: Store car images with an
Image
model, facilitating the association of images with specific cars for a richer visual experience.
By introducing these supplementary data models, our application becomes more comprehensive, organized, and feature-rich. This improvement elevates the overall functionality and user experience, ensuring a more robust and valuable tool for managing and exploring our car inventory.
The application includes a sett of unit tests. Run the tests using PHPUnit:
./vendor/bin/phpunit