Skip to content

Commit

Permalink
Merge pull request #9 from poing/analysis-J2pprb
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
poing committed Jun 12, 2020
2 parents debf874 + 9c8e0fa commit b670738
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
1 change: 0 additions & 1 deletion source/Events/EarMarkRefill.php
Expand Up @@ -8,7 +8,6 @@
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;


class EarMarkRefill
{
use Dispatchable, InteractsWithSockets, SerializesModels;
Expand Down
30 changes: 16 additions & 14 deletions source/Http/Controllers/Serial.php
Expand Up @@ -4,8 +4,8 @@

use DB;
use Illuminate\Routing\Controller;
use Poing\Earmark\Events\EarMarkRefill;
use Illuminate\Support\Facades\Log;
use Poing\Earmark\Events\EarMarkRefill;
use Poing\Earmark\Jobs\EarmarkQueue;

class Serial extends Controller
Expand Down Expand Up @@ -48,11 +48,11 @@ class Serial extends Controller
*/
public function __construct($altPrefix = null, $altSuffix = null, $altPadding = null, $altMin = null, $altMax = null)
{
//Log::debug('Serial Construct');
//Log::debug('Serial Construct');

$this->model = config('earmark.model');

$this->prefix = $altPrefix ?: config('earmark.prefix');
$this->prefix = $altPrefix ?: config('earmark.prefix');
$this->suffix = $altSuffix ?: config('earmark.suffix');

$this->digit = config('earmark.columns.digit');
Expand All @@ -74,11 +74,13 @@ public function get($count = null)
$data[] = $this->affix($this->getEarMark());
}
//event(new EarMarkRefill());
EarmarkQueue::dispatch($this->prefix, $this->suffix, $this->padding, $this->min, $this->max);
EarmarkQueue::dispatch($this->prefix, $this->suffix, $this->padding, $this->min, $this->max);

return $data;
} else {
// event(new EarMarkRefill());
EarmarkQueue::dispatch($this->prefix, $this->suffix, $this->padding, $this->min, $this->max);
// event(new EarMarkRefill());
EarmarkQueue::dispatch($this->prefix, $this->suffix, $this->padding, $this->min, $this->max);

return $this->affix($this->getEarMark());
}
}
Expand Down Expand Up @@ -183,13 +185,13 @@ private function generateHold()

public function refill()
{
Log::info('Check Refill');
Log::info('Check Refill');

$hold = config('earmark.hold_model');
$count = $this->checkHold();
$floor = config('earmark.hold') / 3;
if ($count < $floor) {
Log::info('Earmark Refilled for ' . $this->prefix);
Log::info('Earmark Refilled for '.$this->prefix);

$this->generateHold();
}
Expand All @@ -198,15 +200,16 @@ public function refill()
private function checkHold()
{
$hold = config('earmark.hold_model');

return $hold::where($this->group, $this->prefix)->count();
}

private function initHold()
{
//Log::debug('Earmark Hold Intilized');
//Log::debug('Earmark Hold Intilized');
if ($this->checkHold() == 0) {
$this->generateHold();
Log::info('Earmark Hold Intilized for ' . $this->prefix);
Log::info('Earmark Hold Intilized for '.$this->prefix);
}
}

Expand Down Expand Up @@ -242,14 +245,13 @@ function () use (&$hold, &$model, &$digit, &$group, &$data

//if ($this->checkHold() < config('earmark.hold'))
//event(new EarMarkRefill());
// $this->prefix, $this->suffix, $this->padding, $this->min, $this->max
//EarmarkQueue::dispatch($this->prefix, $this->suffix, $this->padding, $this->min, $this->max);

// $this->prefix, $this->suffix, $this->padding, $this->min, $this->max
//EarmarkQueue::dispatch($this->prefix, $this->suffix, $this->padding, $this->min, $this->max);

return $data;
}

private function insertHold($newDigit)
private function insertHold($newDigit)
{
$model = config('earmark.hold_model');

Expand Down
3 changes: 1 addition & 2 deletions source/Listeners/EarMarkLowHold.php
Expand Up @@ -4,10 +4,9 @@

use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Facades\Log;
use Poing\Earmark\Events\EarMarkRefill;
use Poing\Earmark\Http\Controllers\Serial;
use Illuminate\Support\Facades\Log;


class EarMarkLowHold implements ShouldQueue
{
Expand Down

0 comments on commit b670738

Please sign in to comment.