Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 643 Bytes

UPGRADE.md

File metadata and controls

32 lines (23 loc) · 643 Bytes

Upgrade Guide

0.x to 1.x

Previously we had model within that package you had to extend but now you don't, you just need to use our trait like you would with HasUlid & HasUuid in Laravel

<?php

namespace App\Models;

- use Malico\LaravelNanoid\Eloquent\Model;
+ use Illuminate\Database\Eloquent\Model;
+ use Malico\LaravelNanoid\HasNanoids;

class Payment extends Model {
+    use HasNanoids;
}

Also, we support 2 methods, nanoidPrefix and nanoidLength, like

public function nanoidLength(): int|array {
    // return [10,15]
    return 2;
}

public function nanoidPrefix(): string {
    return 'pay_'
}