diff --git a/src/CreatedByServiceProvider.php b/src/CreatedByServiceProvider.php index d6418cc..5c76d46 100644 --- a/src/CreatedByServiceProvider.php +++ b/src/CreatedByServiceProvider.php @@ -25,6 +25,7 @@ public function packageRegistered(): void { if (! Blueprint::hasMacro('createdBy')) { Blueprint::macro('createdBy', function () { + /** @var Blueprint $this */ $this->foreignIdFor(config('auth.providers.users.model', User::class), 'created_by') ->nullable() ->default(null); @@ -32,6 +33,7 @@ public function packageRegistered(): void } if (! Blueprint::hasMacro('updatedBy')) { Blueprint::macro('updatedBy', function () { + /** @var Blueprint $this */ $this->foreignIdFor(config('auth.providers.users.model', User::class), 'updated_by') ->nullable() ->default(null); @@ -39,6 +41,7 @@ public function packageRegistered(): void } if (! Blueprint::hasMacro('deletedBy')) { Blueprint::macro('deletedBy', function () { + /** @var Blueprint $this */ $this->foreignIdFor(config('auth.providers.users.model', User::class), 'deleted_by') ->nullable() ->default(null); @@ -46,6 +49,7 @@ public function packageRegistered(): void } if (! Blueprint::hasMacro('restoredBy')) { Blueprint::macro('restoredBy', function () { + /** @var Blueprint $this */ $this->foreignIdFor(config('auth.providers.users.model', User::class), 'restored_by') ->nullable() ->default(null); @@ -53,31 +57,37 @@ public function packageRegistered(): void } if (! Blueprint::hasMacro('restoredAt')) { Blueprint::macro('restoredAt', function () { + /** @var Blueprint $this */ $this->timestamp('restored_at')->nullable()->default(null); }); } if (! Blueprint::hasMacro('dropCreatedBy')) { Blueprint::macro('dropCreatedBy', function () { + /** @var Blueprint $this */ $this->dropColumn('created_by'); }); } if (! Blueprint::hasMacro('dropUpdatedBy')) { Blueprint::macro('dropUpdatedBy', function () { + /** @var Blueprint $this */ $this->dropColumn('updated_by'); }); } if (! Blueprint::hasMacro('dropDeletedBy')) { Blueprint::macro('dropDeletedBy', function () { + /** @var Blueprint $this */ $this->dropColumn('deleted_by'); }); } if (! Blueprint::hasMacro('dropRestoredBy')) { Blueprint::macro('dropRestoredBy', function () { + /** @var Blueprint $this */ $this->dropColumn('restored_by'); }); } if (! Blueprint::hasMacro('dropRestoredAt')) { Blueprint::macro('dropRestoredAt', function () { + /** @var Blueprint $this */ $this->dropColumn('restored_at'); }); }