24小时内连续登录失败3次则封禁账号
parent
91f7b524fe
commit
fac1dbdb63
|
|
@ -10,6 +10,10 @@ class AdminUser extends BaseAdminModel
|
||||||
{
|
{
|
||||||
use HasApiTokens, Filterable;
|
use HasApiTokens, Filterable;
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'banned_at' => 'datetime',
|
||||||
|
];
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
'name',
|
||||||
'username',
|
'username',
|
||||||
|
|
@ -20,6 +24,8 @@ class AdminUser extends BaseAdminModel
|
||||||
'status',
|
'status',
|
||||||
'is_enable',
|
'is_enable',
|
||||||
'view_all_bases',
|
'view_all_bases',
|
||||||
|
'banned_reason',
|
||||||
|
'banned_at',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,16 @@ use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
|
public function getConnection()
|
||||||
|
{
|
||||||
|
return $this->config('database.connection') ?: config('database.default');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function config($key)
|
||||||
|
{
|
||||||
|
return config('admin.'.$key);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
|
|
@ -13,7 +23,7 @@ return new class extends Migration
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::table('admin_users', function (Blueprint $table) {
|
Schema::table($this->config('database.users_table'), function (Blueprint $table) {
|
||||||
$table->boolean('view_all_bases')->default(false)->comment('是否可查看所有基地');
|
$table->boolean('view_all_bases')->default(false)->comment('是否可查看所有基地');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -25,7 +35,7 @@ return new class extends Migration
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::table('admin_users', function (Blueprint $table) {
|
Schema::table($this->config('database.users_table'), function (Blueprint $table) {
|
||||||
$table->dropColumn(['view_all_bases']);
|
$table->dropColumn(['view_all_bases']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function getConnection()
|
||||||
|
{
|
||||||
|
return $this->config('database.connection') ?: config('database.default');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function config($key)
|
||||||
|
{
|
||||||
|
return config('admin.'.$key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table($this->config('database.users_table'), function (Blueprint $table) {
|
||||||
|
$table->string('banned_reason')->nullable()->comment('封禁原因');
|
||||||
|
$table->timestamp('banned_at')->nullable()->comment('封禁时间');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table($this->config('database.users_table'), function (Blueprint $table) {
|
||||||
|
$table->timestamp(['banned_reason', 'banned_at']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue