frontend & backend update

This commit is contained in:
carodej
2020-06-19 08:03:29 +02:00
parent 95bc310def
commit a2cab6198e
83 changed files with 4464 additions and 1907 deletions
+12
View File
@@ -0,0 +1,12 @@
<?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use App\UserCard;
use Faker\Generator as Faker;
$factory->define(UserCard::class, function (Faker $faker) {
return [
//
];
});
@@ -26,7 +26,7 @@ class CreateFileManagerFiles extends Migration
$table->text('mimetype')->nullable();
$table->text('filesize')->nullable();
$table->enum('type', ['image', 'file'])->nullable();
$table->text('type')->nullable();
$table->softDeletes();
$table->timestamps();
@@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class ChangeTypeAttributeInFileManagerFilesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('file_manager_files', function (Blueprint $table) {
DB::statement('ALTER TABLE file_manager_files MODIFY type TEXT;');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('file_manager_files', function (Blueprint $table) {
//
});
}
}
@@ -23,6 +23,7 @@ class CreatePaymentGatewaysTable extends Migration
$table->text('client_id')->nullable();
$table->text('secret')->nullable();
$table->text('webhook')->nullable();
$table->bigInteger('payment_processed')->default(0);
$table->longText('optional')->nullable();
});
}
@@ -17,6 +17,7 @@ class CreateInvoicesTable extends Migration
$table->bigIncrements('id');
$table->text('token');
$table->text('order');
$table->text('provider');
$table->text('user_id');
$table->text('plan_id');
$table->longText('seller');
@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUserCardsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_cards', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id');
$table->text('provider');
$table->text('card_id');
$table->text('brand');
$table->text('last4');
$table->text('exp_month');
$table->text('exp_year');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_cards');
}
}
@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddStatusToUserCardsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('user_cards', function (Blueprint $table) {
$table->text('status')->after('provider');
$table->boolean('default')->default(0)->after('provider');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('user_cards', function (Blueprint $table) {
$table->removeColumn('status');
$table->removeColumn('default');
});
}
}
@@ -1,69 +0,0 @@
<?php
declare(strict_types=1);
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePlansTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
{
Schema::create(config('rinvex.subscriptions.tables.plans'), function (Blueprint $table) {
// Columns
$table->increments('id');
$table->string('slug');
$table->{$this->jsonable()}('name');
$table->{$this->jsonable()}('description')->nullable();
$table->boolean('is_active')->default(true);
$table->decimal('price')->default('0.00');
$table->decimal('signup_fee')->default('0.00');
$table->string('currency', 3);
$table->smallInteger('trial_period')->unsigned()->default(0);
$table->string('trial_interval')->default('day');
$table->smallInteger('invoice_period')->unsigned()->default(0);
$table->string('invoice_interval')->default('month');
$table->smallInteger('grace_period')->unsigned()->default(0);
$table->string('grace_interval')->default('day');
$table->tinyInteger('prorate_day')->unsigned()->nullable();
$table->tinyInteger('prorate_period')->unsigned()->nullable();
$table->tinyInteger('prorate_extend_due')->unsigned()->nullable();
$table->smallInteger('active_subscribers_limit')->unsigned()->nullable();
$table->mediumInteger('sort_order')->unsigned()->default(0);
$table->timestamps();
$table->softDeletes();
// Indexes
$table->unique('slug');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
Schema::dropIfExists(config('rinvex.subscriptions.tables.plans'));
}
/**
* Get jsonable column data type.
*
* @return string
*/
protected function jsonable(): string
{
$driverName = DB::connection()->getPdo()->getAttribute(PDO::ATTR_DRIVER_NAME);
$dbVersion = DB::connection()->getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION);
$isOldVersion = version_compare($dbVersion, '5.7.8', 'lt');
return $driverName === 'mysql' && $isOldVersion ? 'text' : 'json';
}
}
@@ -1,61 +0,0 @@
<?php
declare(strict_types=1);
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePlanFeaturesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
{
Schema::create(config('rinvex.subscriptions.tables.plan_features'), function (Blueprint $table) {
// Columns
$table->increments('id');
$table->integer('plan_id')->unsigned();
$table->string('slug');
$table->{$this->jsonable()}('name');
$table->{$this->jsonable()}('description')->nullable();
$table->string('value');
$table->smallInteger('resettable_period')->unsigned()->default(0);
$table->string('resettable_interval')->default('month');
$table->mediumInteger('sort_order')->unsigned()->default(0);
$table->timestamps();
$table->softDeletes();
// Indexes
$table->unique(['plan_id', 'slug']);
$table->foreign('plan_id')->references('id')->on(config('rinvex.subscriptions.tables.plans'))
->onDelete('cascade')->onUpdate('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
Schema::dropIfExists(config('rinvex.subscriptions.tables.plan_features'));
}
/**
* Get jsonable column data type.
*
* @return string
*/
protected function jsonable(): string
{
$driverName = DB::connection()->getPdo()->getAttribute(PDO::ATTR_DRIVER_NAME);
$dbVersion = DB::connection()->getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION);
$isOldVersion = version_compare($dbVersion, '5.7.8', 'lt');
return $driverName === 'mysql' && $isOldVersion ? 'text' : 'json';
}
}
@@ -1,63 +0,0 @@
<?php
declare(strict_types=1);
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePlanSubscriptionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
{
Schema::create(config('rinvex.subscriptions.tables.plan_subscriptions'), function (Blueprint $table) {
$table->increments('id');
$table->morphs('user');
$table->integer('plan_id')->unsigned();
$table->string('slug');
$table->{$this->jsonable()}('name');
$table->{$this->jsonable()}('description')->nullable();
$table->dateTime('trial_ends_at')->nullable();
$table->dateTime('starts_at')->nullable();
$table->dateTime('ends_at')->nullable();
$table->dateTime('cancels_at')->nullable();
$table->dateTime('canceled_at')->nullable();
$table->string('timezone')->nullable();
$table->timestamps();
$table->softDeletes();
// Indexes
$table->unique('slug');
$table->foreign('plan_id')->references('id')->on(config('rinvex.subscriptions.tables.plans'))
->onDelete('cascade')->onUpdate('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
Schema::dropIfExists(config('rinvex.subscriptions.tables.plan_subscriptions'));
}
/**
* Get jsonable column data type.
*
* @return string
*/
protected function jsonable(): string
{
$driverName = DB::connection()->getPdo()->getAttribute(PDO::ATTR_DRIVER_NAME);
$dbVersion = DB::connection()->getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION);
$isOldVersion = version_compare($dbVersion, '5.7.8', 'lt');
return $driverName === 'mysql' && $isOldVersion ? 'text' : 'json';
}
}
@@ -1,44 +0,0 @@
<?php
declare(strict_types=1);
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePlanSubscriptionUsageTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
{
Schema::create(config('rinvex.subscriptions.tables.plan_subscription_usage'), function (Blueprint $table) {
$table->increments('id');
$table->integer('subscription_id')->unsigned();
$table->integer('feature_id')->unsigned();
$table->smallInteger('used')->unsigned();
$table->dateTime('valid_until')->nullable();
$table->string('timezone')->nullable();
$table->timestamps();
$table->softDeletes();
$table->unique(['subscription_id', 'feature_id']);
$table->foreign('subscription_id')->references('id')->on(config('rinvex.subscriptions.tables.plan_subscriptions'))
->onDelete('cascade')->onUpdate('cascade');
$table->foreign('feature_id')->references('id')->on(config('rinvex.subscriptions.tables.plan_features'))
->onDelete('cascade')->onUpdate('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
Schema::dropIfExists(config('rinvex.subscriptions.tables.plan_subscription_usage'));
}
}