This is a Laravel-based e-commerce application with the following features:
- User List: Displays a list of all users on the home page.
- Login as User: Allows to log in as any user by clicking a button next to the user's name.
- Product List: Displays a paginated list of products.
- Pagination: Products are displayed with pagination to improve performance and user experience.
- View Cart: Displays the user's cart items.
- Add to Cart: Allows users to add products to their cart.
- Update Cart: Allows users to update the quantity of products in their cart.
- Remove from Cart: Allows users to remove products from their cart.
- Timezone Test: Returns the current date and time.
-
Clone the repository:
git clone https://github.com/I3rixon/cartEst.git cd cartEst -
Install dependencies:
composer install npm install
-
Copy the .env.example file to .env and configure your environment variables:
cp .env.example .env
-
Generate an application key:
php artisan key:generate
-
Run migrations:
php artisan migrate
-
Seed the database (optional):
php artisan db:seed
-
Start the development server:
php artisan serve
- Visit the home page to see the list of users.
- Navigate to the products page to see the list of products with pagination.
- Add, update, or remove products from the cart.
- Use the "Login as User" feature to log in as any user.
This project is licensed under the MIT License.
-
Updated web.php:
- Added auth middleware to routes for adding, updating, and removing items from the cart.
- Ensured only authenticated users can access these routes.
-
Updated CartControllerTest:
- Ensured the user and product exist before running tests.
- Used withoutMiddleware to bypass CSRF token validation for testing purposes.
- Added assertions to verify the correct response and database state.




