Skip to content

Latest commit

 

History

History
47 lines (31 loc) · 1017 Bytes

getting-started.md

File metadata and controls

47 lines (31 loc) · 1017 Bytes

Getting started

Generate your first SKU in three steps. See the Documentation index.

1. Install + publish

composer require simtabi/lacommerce
php artisan vendor:publish --tag=simtabi::lacommerce-config

See Installation.

2. Add the trait

Add HasSku to a model that has an sku column:

use Simtabi\Lacommerce\Traits\HasSku;
use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    use HasSku;
}

3. Save — the SKU is generated

$product = new Product();
$product->name = 'Laravel is Awesome';
$product->save();

echo $product->sku; // "LAR-8056449213"

Order numbers and ticket numbers work the same way via HasOrderNumber / HasTicketNumber.

Next steps

  • Generators — all three generators, per-model config, custom generators.
  • Configuration — every config/simtabi/lacommerce.php key.

← Docs index