PHP code example of jeffersongoncalves / laravel-erp-core

1. Go to this page and download the library: Download jeffersongoncalves/laravel-erp-core library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jeffersongoncalves / laravel-erp-core example snippets


use Illuminate\Database\Eloquent\Model;
use JeffersonGoncalves\Erp\Core\Concerns\IsSubmittable;
use JeffersonGoncalves\Erp\Core\Contracts\SubmittableDocument;
use JeffersonGoncalves\Erp\Core\Enums\DocStatus;

class SalesInvoice extends Model implements SubmittableDocument
{
    use IsSubmittable;

    protected $casts = ['docstatus' => DocStatus::class];
}

$invoice->submit();   // Draft → Submitted, dispatches DocumentSubmitted
$invoice->cancel();   // Submitted → Cancelled, dispatches DocumentCancelled

use JeffersonGoncalves\Erp\Core\Concerns\HasNamingSeries;

class SalesInvoice extends Model
{
    use HasNamingSeries;

    protected function namingSeriesPattern(): ?string
    {
        return 'SINV-.YYYY.-';
    }
}

// On create with an empty `name`: SINV-2026-00001, SINV-2026-00002, ...
bash
php artisan vendor:publish --tag="erp-core-migrations"
php artisan migrate