app/View/Components/ with corresponding Blade templates in resources/views/components/.
Available Components
ProductCard
Display automotive parts with pricing and availability
Navbar
Main navigation header with cart and user links
Footer
Site footer with links and contact information
Alert
Display notifications and alerts to users
ProductCard Component
The ProductCard component displays individual automotive parts in the catalog with pricing, stock status, and add-to-cart functionality.Component Class
Location:app/View/Components/ProductCard.php
Blade Template
Location:resources/views/components/product-card.blade.php
Usage Example
Here’s how the ProductCard is used in the catalog view (resources/views/catalogos/catalogo.blade.php:36-51):
Product Card States
- Available
- Out of Stock
Products with stock display a green checkmark and available quantity:
Navbar Component
The Navbar component provides the main navigation header used across all pages.Component Class
Location:app/View/Components/Navbar.php
Usage in Layout
The Navbar is included in the main layout (resources/views/layouts/app.blade.php:14):
Navbar Features
The navbar typically includes:- Logo: Link to home page
- Cart Link: Shopping cart with item count badge
- Orders Link: Access to order history
- User Link: Authentication and profile access
Footer Component
The Footer component displays site links, contact information, and social media links.Component Class
Location:app/View/Components/Footer.php
Usage in Layout
The Footer is included in the main layout (resources/views/layouts/app.blade.php:16):
Footer Structure
The footer includes multiple sections as seen inresources/views/home/index.blade.php:232-273:
Alert Component
The Alert component displays notifications and messages to users.Component Class
Location:app/View/Components/Alert.php
Usage Example
Alerts can be used throughout the application to display messages:Creating Custom Components
To create a new Blade component:-
Generate the component class:
-
Define the component logic in
app/View/Components/ComponentName.php -
Create the Blade template in
resources/views/components/component-name.blade.php -
Use the component in your views:
Best Practices
Keep Components Focused
Each component should have a single, clear responsibility
Use Props
Pass data to components using attributes and props
Style Consistently
Maintain consistent styling across all components
Document Usage
Provide clear examples of how to use each component