Looking to hire Laravel developers? Try LaraJobs

autonumber-laravel maintained by frikishaan

Description
Generate Autonumbers for your Laravel Models
Author
Last update
2022/01/14 17:11 (dev-main)
License
Downloads
10

Comments
comments powered by Disqus

Generate Autonumbers for your Laravel Model

Latest Version on Packagist Total Downloads GitHub Actions StyleCI License

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.