Change Private Reference Number

This changes the Private Reference Number (Data in QR Code), less chance of getting double ID's and I think its more secure.
This commit is contained in:
mrlexley 2019-04-05 20:13:32 +02:00
parent 6a683d905f
commit 33ea0250e0
3 changed files with 35 additions and 1 deletions

1
.gitignore vendored
View File

@ -11,6 +11,7 @@ installed
/composer.phar
_ide_helper.php
*.swp
composer.lock
# Do not include backup lang files
resources/lang/*/[a-zA-Z]*20[0-9][0-9][0-1][0-9][0-3][0-9]_[0-2][0-9][0-5][0-9][0-5][0-9].php

View File

@ -3,6 +3,7 @@
namespace App\Models;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Str;
/*
Attendize.com - Event Management & Ticketing
@ -44,7 +45,7 @@ class Attendee extends MyBaseModel
parent::boot();
static::creating(function ($order) {
$order->private_reference_number = str_pad(random_int(0, pow(10, 9) - 1), 9, '0', STR_PAD_LEFT);
$order->private_reference_number = \Str::Random(10);
});
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ChangePrivateReferenceNumberColumnType extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('attendees', function ($t) {
$t->string('private_reference_number', 15)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('attendees', function ($t) {
$t->integer('private_reference_number')->change();
});
}
}