Laravel Integration

This document will help you set up the Laravel framework on a Windows machine and further the development process that includes REST APIs.

Step 1: Installation

Create a Laravel Project

composer create-project --prefer-dist laravel/laravel piappstudio

php artisan serve


Create a Models

php artisan make:model Customer --all

php artisan make:model Invoice --all

class Customer extends Model

{

    use HasFactory;

    public function invoices() {

        return $this->hasMany(Invoice::class);

    }

}


class Invoice extends Model

{

    use HasFactory;

    public function customer() {

        return $this->BelongsTo(Customer::class);

    }

}


DB_CONNECTION=mysql

DB_HOST=127.0.0.1

DB_PORT=3306

DB_DATABASE=piappstudio

DB_USERNAME=root

DB_PASSWORD=******

php artisan migrate:fresh --seed


To Add Route Service provider


php artisan make:Provider RouteServiceProvider


To integrate sanctum:

composer require laravel/sanctum

php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"