Overview (What you'll do)
This guide provides a complete walkthrough for setting up a Laravel project, improving its appearance, and adding international tax functionality. It's designed for beginners but includes advanced techniques.
You'll learn how to:
- Install required tools (XAMPP/Laragon, Composer, Node, VS Code)
- Copy project locally, install dependencies, import the database
- Run the app locally with
php artisan serve
- Find and edit homepage texts in Blade views
- Use AI in VS Code to assist with refactoring and content edits
- Add an international tax module (country-based, toggleable)
Prerequisites
Basic knowledge of HTML, PHP, and command line usage. No prior Laravel experience required.
1 Tools to install (beginner friendly)
Set up your development environment with these essential tools:
- XAMPP or Laragon - Provides PHP, MySQL, and Apache in one installer
- Composer - PHP package manager for Laravel dependencies
- Node.js - Required for frontend asset compilation
- VS Code - Modern code editor with excellent Laravel support
- Optional AI tools: GitHub Copilot Chat, Continue.dev, or Cursor
Windows Tip
Laragon is highly recommended for Windows users as it requires minimal configuration for Laravel projects and includes useful tools like automatic virtual hosts.
2 Copy the project locally
- Copy the entire Laravel folder (including
app/
,resources/
,routes/
, andcomposer.json
) to your development directory - Open the folder in VS Code using
File → Open Folder
- Verify the project structure in the Explorer view
3 Install PHP & frontend dependencies
Open VS Code terminal (Ctrl+` ) inside the project and run:
composer install # Install PHP dependencies
npm install # Install JavaScript dependencies
npm run dev # Compile frontend assets
Troubleshooting
If composer or npm fail, ensure they're properly installed and available in your system PATH. If the project uses Vite instead of Mix, run npm run build
for production assets.
4 Create & import the database
- Start XAMPP/Laragon and open phpMyAdmin (typically at
http://localhost/phpmyadmin
) - Create a new database (e.g.,
laravel_app
) - Import your
.sql
file using the Import tab
Large Database Import
For large SQL files, use the command line to avoid timeout issues:
mysql -u root -p laravel_app < path/to/yourfile.sql
Press Enter and provide your MySQL password when prompted (usually blank for XAMPP).
5 Configure Laravel to use the DB
Update the project's .env
file with your database credentials:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel_app
DB_USERNAME=root
DB_PASSWORD=
If your MySQL installation has a password, add it to the DB_PASSWORD field. Save the file after making changes.
6 Serve the app locally
In the VS Code terminal, run:
php artisan serve
Visit the provided address (typically http://127.0.0.1:8000
) in your browser to view the application.
7 Where the homepage text lives
Laravel follows the MVC pattern. To edit homepage content:
- Check
routes/web.php
for the root route (Route::get('/', ...)
) - If it returns a view directly (e.g.,
view('welcome')
), editresources/views/welcome.blade.php
- If it uses a controller (e.g.,
HomeController@index
), check the controller method to see which view it returns - Also check:
resources/views/components/
,resources/js/components
, andresources/lang/
for component-based or localized text - For database-driven content, inspect controller queries and the corresponding database tables
SPA Applications
If the project uses React or Vue, the homepage may be in resources/js
components rather than Blade templates.
9 Improve appearance using Blade + CSS
Modernize the homepage with these techniques:
- Use a layout file (
resources/views/layouts/app.blade.php
) for consistent structure - Add a responsive hero section with modern styling
- Update CSS/SCSS files in
resources/css
and recompile withnpm run dev
- Implement responsive design with media queries or utility classes
<!-- Example hero section -->
<section class="hero bg-gradient-to-r from-blue-500 to-indigo-600 py-20">
<div class="container mx-auto px-4 text-center">
<h1 class="text-4xl font-bold text-white mb-4">ReaffordOS</h1>
<p class="text-xl text-blue-100 max-w-2xl mx-auto">
A complete product, service receipting, and inventory sales solution.
</p>
</div>
</section>
10 Use AI in VS Code to help
AI tools can accelerate your development workflow:
Effective AI Prompts
- Navigation: "Find the route that handles '/' and show me the view it returns"
- Refactoring: "Refactor this Blade file to use a responsive hero section with modern styling"
- Feature Development: "Create a migration to add 'country' and 'tax_enabled' fields to users table"
- Code Explanation: "Explain how this TaxService calculates taxes based on country"
AI Best Practices
Always review AI-generated code, run tests, and commit changes to version control before implementation.
11 Add International Tax Support
We'll implement a flexible tax system that:
- Stores user country and tax enabled status
- Uses config-based tax rates per country
- Provides a TaxService for checkout calculations
11.1 — Create a migration
Run in terminal:
php artisan make:migration add_tax_fields_to_users_table --table=users
Edit the migration file:
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('country', 2)->nullable()->after('email');
$table->boolean('tax_enabled')->default(false)->after('country');
});
}
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['country', 'tax_enabled']);
});
}
Run the migration: php artisan migrate
11.2 — Add tax rates config
Create config/taxes.php
:
<?php
return [
// country_code => rate (decimal)
'US' => 0.07, // United States
'CA' => 0.05, // Canada
'GB' => 0.20, // United Kingdom
'DE' => 0.19, // Germany
'FR' => 0.20, // France
'AU' => 0.10, // Australia
'JP' => 0.08, // Japan
// Add more countries as needed
];
11.3 — Create a TaxService
Create app/Services/TaxService.php
:
<?php
namespace App\Services;
class TaxService
{
public function calculate(
float $amount,
?string $country,
bool $taxEnabled
): array {
if (!$taxEnabled || empty($country)) {
return ['tax' => 0.00, 'total' => $amount, 'rate' => 0.0];
}
$rates = config('taxes', []);
$rate = $rates[$country] ?? 0;
$tax = round($amount * $rate, 2);
$total = round($amount + $tax, 2);
return compact('tax', 'total', 'rate');
}
}
11.4 — Use TaxService in checkout
In your checkout logic:
use App\Services\TaxService;
public function checkout(Request $request, TaxService $taxService)
{
$user = auth()->user();
$subtotal = Cart::total(); // Example cart total
$taxResult = $taxService->calculate(
$subtotal,
$user->country,
$user->tax_enabled
);
// Access values:
// $taxResult['tax'], $taxResult['total'], $taxResult['rate']
// Proceed with order creation...
}
11.5 — Add user settings UI
Create a settings form in Blade:
<form method="POST" action="{{ route('user.settings.update') }}">
@csrf
@method('PUT')
<div class="mb-4">
<label class="block text-gray-700 mb-2">Country</label>
<select name="country" class="w-full p-2 border rounded">
<option value="">Select Country</option>
<option value="US" {{ $user->country == 'US' ? 'selected' : '' }}>United States</option>
<option value="CA" {{ $user->country == 'CA' ? 'selected' : '' }}>Canada</option>
<option value="GB" {{ $user->country == 'GB' ? 'selected' : '' }}>United Kingdom</option>
<!-- Add more countries -->
</select>
</div>
<div class="mb-4">
<label class="flex items-center">
<input type="checkbox" name="tax_enabled" value="1"
{{ $user->tax_enabled ? 'checked' : '' }} class="mr-2" />
Enable Tax Calculation
</label>
</div>
<button type="submit" class="bg-blue-500 text-white py-2 px-4 rounded">
Save Settings
</button>
</form>
Production Considerations
For complex tax requirements, consider integrating with services like TaxJar or Avalara. Always validate country codes and handle edge cases like tax-exempt customers.
12 Git workflow & safety tips
- Initialize Git:
git init
- Stage changes:
git add .
- Commit:
git commit -m "Add international tax feature"
- Work in feature branches:
git checkout -b feat/tax-module
- Test changes thoroughly before deployment
- Maintain regular database backups
13 Example AI prompts
Effective AI Prompts for Laravel
- Navigation: "Where is the homepage route defined and which view does it use?"
- Refactoring: "Update the homepage hero section with a modern gradient background and centered content"
- Tax Feature: "Create a Laravel service class that calculates tax based on country code with configurable rates"
- Debugging: "Why am I getting a 'Class TaxService not found' error and how do I fix it?"
- Optimization: "How can I cache tax rates to improve performance?"