girover / sequent-numbers
Generating database table for Sequent Numbers as strings
v0.1.0-alpha
2022-07-09 16:38 UTC
Requires
- php: ^8.0
- illuminate/contracts: ^8.0|^9.0
- spatie/laravel-package-tools: ^1.4.3
Requires (Dev)
- brianium/paratest: ^6.2
- nunomaduro/collision: ^5.3
- orchestra/testbench: ^6.15
- phpunit/phpunit: ^9.3
- spatie/laravel-ray: ^1.23
- vimeo/psalm: ^4.8
This package is not auto-updated.
Last update: 2024-11-13 05:11:05 UTC
README
Content
- Introduction
- Prerequisites
- Installation
- Configuration
- Usage
- Testing
- Changelog
- Contributing
- Security Vulnerabilities
- Credits
- License
Introduction
girover/sequent-numbers is a package for generating sequence of numbers.
And possibility of storing them in database.
Prerequisites
- Laravel 8+
- PHP 8+
- Mysql 5.7+
Installation
You can add the package via composer:
composer require girover/sequent-numbers
Before installing the package you should configure your database.
Usage
getting set of numbers
To make a set of numbers in memory, you can do this.
// InAController use \Girover\SequentNumbers\Numbers; $numbers = new Numbers; $numbers->from('00000')->to('99999')->get() // This will return Illuminate\Database\Eloquent\Collection
To add some constraints on your numbers:
// InAController use \Girover\SequentNumbers\Numbers; $numbers = new Numbers; $numbers->from("0000")->to("9999"); $numbers->query()->where('number', '>', '1000')->get(); // This will return Illuminate\Database\Eloquent\Collection $numbers->query()->whereBetween('number', ["5555","7777"])->get(); // This will return Illuminate\Database\Eloquent\Collection
Storing Numbers in Database
To store your created numbers in the database, you can do this:
// InAController use \Girover\SequentNumbers\Numbers; $numbers = new Numbers; $numbers->from("0000")->to("9999"); $numbers->storeInTable('my_numbers_table');
Note: If the name of table already exists in database, the table should has a column called 'number' with varchar(255) type.