From d2eaff9858e25cd7130c50c3b2920003565f9c2a Mon Sep 17 00:00:00 2001 From: MarceauKa Date: Thu, 2 Jan 2020 16:13:30 +0100 Subject: [PATCH] :wrench: Fix migrations :recycle: Clean models and traits :white_check_mark: PHP 7.4 CI --- .travis.yml | 1 + migrations/create_devices_table.php.stub | 2 ++ migrations/create_logins_table.php.stub | 4 ++-- src/Models/Device.php | 2 -- src/Models/HasLoginsAndDevices.php | 1 - 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1895a0b..3e91975 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: php php: +- 7.4 - 7.3 - 7.2 before_script: composer install diff --git a/migrations/create_devices_table.php.stub b/migrations/create_devices_table.php.stub index e85d916..af745d5 100644 --- a/migrations/create_devices_table.php.stub +++ b/migrations/create_devices_table.php.stub @@ -22,6 +22,8 @@ class CreateDevicesTable extends Migration $table->boolean('is_trusted')->default(0)->index(); $table->boolean('is_untrusted')->default(0)->index(); $table->timestamps(); + + // $table->index(['user_id', 'user_type']); }); } diff --git a/migrations/create_logins_table.php.stub b/migrations/create_logins_table.php.stub index d702e5a..9d275f8 100644 --- a/migrations/create_logins_table.php.stub +++ b/migrations/create_logins_table.php.stub @@ -11,13 +11,13 @@ class CreateLoginsTable extends Migration Schema::create('logins', function (Blueprint $table) { $table->bigIncrements('id'); $table->ipAddress('ip_address'); - $table->string('type')->default(\Lab404\AuthChecker\Models\Login::TYPE_LOGIN)->index(); + $table->string('type')->default(\Lab404\AuthChecker\Models\Login::TYPE_LOGIN); $table->bigInteger('user_id')->unsigned(); $table->string('user_type'); $table->bigInteger('device_id')->unsigned()->index()->nullable(); $table->timestamps(); - // $table->foreign('device_id')->references('id')->on('devices')->onDelete('cascade'); + // $table->index(['user_id', 'user_type']); }); } diff --git a/src/Models/Device.php b/src/Models/Device.php index 3768ee3..b79e70d 100644 --- a/src/Models/Device.php +++ b/src/Models/Device.php @@ -3,10 +3,8 @@ namespace Lab404\AuthChecker\Models; use Illuminate\Database\Eloquent\Model; -use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasOne; -use Illuminate\Database\Eloquent\Relations\MorphOne; use Illuminate\Database\Eloquent\Relations\MorphTo; /** diff --git a/src/Models/HasLoginsAndDevices.php b/src/Models/HasLoginsAndDevices.php index 2669118..002d54f 100644 --- a/src/Models/HasLoginsAndDevices.php +++ b/src/Models/HasLoginsAndDevices.php @@ -2,7 +2,6 @@ namespace Lab404\AuthChecker\Models; -use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\MorphMany; /**