implementation of user limits and refactoring

This commit is contained in:
Čarodej
2021-11-19 18:44:46 +01:00
parent 4851fb5eab
commit 6ca84d9041
54 changed files with 300 additions and 327 deletions

View File

@@ -29,11 +29,7 @@ class UserFactory extends Factory
'email_verified_at' => now(),
'password' => bcrypt('secret'),
'remember_token' => Str::random(10),
'created_at' => $this->faker->dateTimeBetween(
$startDate = '-36 months',
$endDate = 'now',
$timezone = null
),
'created_at' => $this->faker->dateTimeBetween('-36 months', 'now', null),
];
}
@@ -48,7 +44,6 @@ class UserFactory extends Factory
$user
->settings()
->create([
'max_storage_amount' => $this->faker->randomNumber(1),
'name' => $this->faker->name,
'address' => $this->faker->address,
'state' => $this->faker->state,

View File

@@ -19,6 +19,8 @@ class CreateUsersTable extends Migration
$table->string('email')->unique()->index();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->text('two_factor_secret')->nullable();
$table->text('two_factor_recovery_codes')->nullable();
$table->rememberToken();
$table->timestamps();
$table->charset = 'utf8mb4';

View File

@@ -1,41 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddTwoFactorColumnsToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->text('two_factor_secret')
->after('password')
->nullable();
$table->text('two_factor_recovery_codes')
->after('two_factor_secret')
->nullable();
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('two_factor_secret', 'two_factor_recovery_codes');
});
}
}

View File

@@ -1,42 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCustomerColumns extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('stripe_id')->nullable()->index();
$table->string('card_brand')->nullable();
$table->string('card_last_four', 4)->nullable();
$table->timestamp('trial_ends_at')->nullable();
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn([
'stripe_id',
'card_brand',
'card_last_four',
'trial_ends_at',
]);
});
}
}

View File

@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateFileManagerFolders extends Migration
class CreateFoldersTable extends Migration
{
/**
* Run the migrations.

View File

@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateFileManagerFiles extends Migration
class CreateFilesTable extends Migration
{
/**
* Run the migrations.

View File

@@ -15,7 +15,6 @@ class CreateUserSettingsTable extends Migration
{
Schema::create('user_settings', function (Blueprint $table) {
$table->uuid('user_id')->index();
$table->integer('max_storage_amount')->default(5);
$table->string('avatar')->nullable();
$table->string('color')->nullable();
$table->text('name')->nullable();

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUserLimitationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_limitations', function (Blueprint $table) {
$table->uuid('user_id');
$table->text('max_storage_amount');
$table->text('max_team_members');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_limitations');
}
}