Generate Autonumbers for your Laravel Model
This package can help you in creating autonumbers for your laravel model. You can create autonumbers using the artisan command, and it will generate the autonumber whenever you create a record using your model.
Installation
You can install the package via composer:
composer require frikishaan/autonumber-laravel
Usage
First you have to run migration. It will create a table in your database named autonumbers
.
php artisan migrate
Then use the below command to create autonumber -
php artisan autonumber:create
Use the HasAutonumber
trait in your model. It will generate the autonumber when you create a record using your model.
<?php
namespace App\Models;
use Frikishaan\Autonumber\Traits\HasAutonumber;
use Illuminate\Database\Eloquent\Model;
class Invoice extends Model
{
use HasAutonumber;
protected $fillable = [
'customer', 'amount',
];
}
Testing
composer test
License
The MIT License (MIT). Please see License File for more information.
This package was generated using the Laravel Package Boilerplate.