Skip to content

Commit 78085d4

Browse files
authored
Merge pull request #21 from poing/0.2.2
0.2.2
2 parents dca1acd + 1245e36 commit 78085d4

14 files changed

+197
-21
lines changed

composer.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"zero-fill",
3636
"zerofill"
3737
],
38-
"version": "0.2.1",
38+
"version": "0.2.2",
3939
"homepage": "https://github.com/poing/earmark",
4040
"license": "MIT",
4141
"authors": [
@@ -54,8 +54,7 @@
5454
"illuminate/database": ">=11.0",
5555
"illuminate/events": ">=11.0",
5656
"illuminate/filesystem": ">=11.0",
57-
"illuminate/support": ">=11.0",
58-
"laravel/legacy-factories": "^1.4"
57+
"illuminate/support": ">=11.0"
5958
},
6059
"require-dev": {
6160
"orchestra/testbench": "^9.0",

source/EarmarkServiceProvider.php

+9
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,16 @@ public function register()
8888
* @return void
8989
*/
9090
protected function registerEloquentFactoriesFrom($path)
91+
{
92+
if (app()->runningInConsole()) {
93+
$this->loadFactoriesFrom($path);
94+
}
95+
}
96+
97+
/* Depreciated
98+
protected function registerEloquentFactoriesFrom($path)
9199
{
92100
$this->app->make(EloquentFactory::class)->load($path);
93101
}
102+
*/
94103
}

source/Http/Controllers/Serial.php

+14
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,27 @@ private function affix($number)
115115
return $this->prefix.$data; // . $this->suffix;
116116
}
117117

118+
private function unfix($number)
119+
{
120+
if ($this->prefix) {
121+
$data = ltrim($number, $this->prefix);
122+
} else {
123+
$data = $number;
124+
}
125+
126+
//return rtrim($data,$this->suffix);
127+
return $data;
128+
}
129+
130+
/*
118131
private function unfix($number)
119132
{
120133
$data = ltrim($number, $this->prefix);
121134
122135
//return rtrim($data,$this->suffix);
123136
return $data;
124137
}
138+
*/
125139

126140
public function getMax()
127141
{
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
use Faker\Generator as Faker;
4+
use Poing\Earmark\Helpers\Boost;
5+
6+
$foo = new Boost;
7+
$count = $foo->autoIncrement();
8+
9+
$factory->define(Poing\Earmark\Models\EarMark::class, function (Faker $faker) use ($count) {
10+
$count->next();
11+
$count->next();
12+
13+
return [
14+
/*
15+
'digit' => $faker->numberBetween(
16+
config('earmark.range.min'),
17+
config('earmark.range.max')
18+
),
19+
*/
20+
'digit' => $autoIncrement->current(),
21+
'prefix' => config('earmark.prefix'),
22+
'type' => $faker->word,
23+
];
24+
});
+21-18
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
<?php
22

3-
use Faker\Generator as Faker;
3+
namespace Database\Factories;
4+
5+
use Illuminate\Database\Eloquent\Factories\Factory;
46
use Poing\Earmark\Helpers\Boost;
7+
use Poing\Earmark\Models\EarMark;
8+
9+
class EarMarkFactory extends Factory
10+
{
11+
protected $model = EarMark::class;
512

6-
$foo = new Boost;
7-
$count = $foo->autoIncrement();
13+
public function definition()
14+
{
15+
$boost = new Boost;
16+
$count = $boost->autoIncrement();
817

9-
$factory->define(Poing\Earmark\Models\EarMark::class, function (Faker $faker) use ($count) {
10-
$count->next();
11-
$count->next();
18+
$count->next();
19+
$count->next();
1220

13-
return [
14-
/*
15-
'digit' => $faker->numberBetween(
16-
config('earmark.range.min'),
17-
config('earmark.range.max')
18-
),
19-
*/
20-
'digit' => $autoIncrement->current(),
21-
'prefix' => config('earmark.prefix'),
22-
'type' => $faker->word,
23-
];
24-
});
21+
return [
22+
'digit' => $count->current(),
23+
'prefix' => config('earmark.prefix'),
24+
'type' => $this->faker->word,
25+
];
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class CreateAccrualsTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('earmark_accrual', function (Blueprint $table) {
17+
$table->bigIncrements('id');
18+
$table->timestamps();
19+
});
20+
}
21+
22+
/**
23+
* Reverse the migrations.
24+
*
25+
* @return void
26+
*/
27+
public function down()
28+
{
29+
Schema::dropIfExists('accruals');
30+
}
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class CreateEarmarkHoldTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('earmark_hold', function (Blueprint $table) {
17+
$table->increments('id');
18+
$table->integer(config('earmark.columns.digit'));
19+
$table->string(config('earmark.columns.group'))->nullable();
20+
$table->timestamps();
21+
22+
$table->index(config('earmark.columns.digit'));
23+
$table->index(config('earmark.columns.group'));
24+
});
25+
26+
// Poing\Earmark\Models\EarMark::max('digit')
27+
// Poing\Earmark\Models\EarMark::where('type','alpha')->max('digit')
28+
}
29+
30+
/**
31+
* Reverse the migrations.
32+
*
33+
* @return void
34+
*/
35+
public function down()
36+
{
37+
Schema::dropIfExists('earmark_hold');
38+
}
39+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class CreateEarmarkTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('earmark', function (Blueprint $table) {
17+
$table->increments('id');
18+
$table->integer(config('earmark.columns.digit'));
19+
$table->string(config('earmark.columns.group'))->nullable();
20+
$table->timestamps();
21+
22+
$table->index(config('earmark.columns.digit'));
23+
$table->index(config('earmark.columns.group'));
24+
});
25+
26+
// Poing\Earmark\Models\EarMark::max('digit')
27+
// Poing\Earmark\Models\EarMark::where('type','alpha')->max('digit')
28+
}
29+
30+
/**
31+
* Reverse the migrations.
32+
*
33+
* @return void
34+
*/
35+
public function down()
36+
{
37+
Schema::dropIfExists('earmark');
38+
}
39+
}

source/database/seeders/EarMark.php

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Database\Seeders;
4+
5+
use Illuminate\Database\Seeder;
6+
7+
class EarMark extends Seeder
8+
{
9+
/**
10+
* Run the database seeds.
11+
*
12+
* @return void
13+
*/
14+
public function run()
15+
{
16+
//
17+
}
18+
}

0 commit comments

Comments
 (0)