mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Add licenses table
This commit is contained in:
parent
aac6831d15
commit
23206d7a67
@ -136,4 +136,37 @@ class Ninja
|
||||
|
||||
return $translations;
|
||||
}
|
||||
|
||||
public function createLicense($request)
|
||||
{
|
||||
// $affiliate = Affiliate::where('affiliate_key', '=', SELF_HOST_AFFILIATE_KEY)->first();
|
||||
// $email = trim(Input::get('email'));
|
||||
|
||||
// if (! $email || $email == TEST_USERNAME) {
|
||||
// return RESULT_FAILURE;
|
||||
// }
|
||||
|
||||
// $license = new License();
|
||||
// $license->first_name = Input::get('first_name');
|
||||
// $license->last_name = Input::get('last_name');
|
||||
// $license->email = $email;
|
||||
// $license->transaction_reference = Request::getClientIp();
|
||||
// $license->license_key = self::generateLicense();
|
||||
// $license->affiliate_id = $affiliate->id;
|
||||
// $license->product_id = PRODUCT_SELF_HOST;
|
||||
// $license->is_claimed = 1;
|
||||
// $license->save();
|
||||
|
||||
// return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
// public static function generateLicense()
|
||||
// {
|
||||
// $parts = [];
|
||||
// for ($i = 0; $i < 5; $i++) {
|
||||
// $parts[] = strtoupper(str_random(4));
|
||||
// }
|
||||
|
||||
// return implode('-', $parts);
|
||||
// }
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateLicensesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
Schema::create('licenses', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->string('first_name')->nullable();
|
||||
$table->string('last_name')->nullable();
|
||||
$table->string('email')->nullable();
|
||||
$table->string('license_key')->unique()->nullable();
|
||||
$table->boolean('is_claimed')->nullable();
|
||||
$table->string('transaction_reference')->nullable();
|
||||
$table->unsignedInteger('product_id')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('licenses');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user