diff --git a/packages/actions/src/Exports/Models/Export.php b/packages/actions/src/Exports/Models/Export.php index 863028abb6..ec68e6a8aa 100644 --- a/packages/actions/src/Exports/Models/Export.php +++ b/packages/actions/src/Exports/Models/Export.php @@ -2,7 +2,6 @@ namespace Filament\Actions\Exports\Models; -use App\Models\User; use Carbon\CarbonInterface; use Exception; use Filament\Actions\Exports\Exporter; @@ -59,12 +58,14 @@ class Export extends Model return $this->belongsTo($authenticatable::class); } - if (! class_exists(User::class)) { - throw new Exception('No [' . Filament::namespaceFor('Models\\User') . '] model found. Please bind an authenticatable model to the [Illuminate\\Contracts\\Auth\\Authenticatable] interface in a service provider\'s [register()] method.'); + $userClass = Filament::namespaceFor('Models\\User'); + + if (! class_exists($userClass)) { + throw new Exception('No [' . $userClass . '] model found. Please bind an authenticatable model to the [Illuminate\\Contracts\\Auth\\Authenticatable] interface in a service provider\'s [register()] method.'); } /** @phpstan-ignore-next-line */ - return $this->belongsTo(User::class); + return $this->belongsTo($userClass); } /** diff --git a/packages/actions/src/Imports/Models/Import.php b/packages/actions/src/Imports/Models/Import.php index ded25fdf6b..ac7a0d6a67 100644 --- a/packages/actions/src/Imports/Models/Import.php +++ b/packages/actions/src/Imports/Models/Import.php @@ -2,7 +2,6 @@ namespace Filament\Actions\Imports\Models; -use App\Models\User; use Carbon\CarbonInterface; use Exception; use Filament\Actions\Imports\Importer; @@ -65,12 +64,14 @@ class Import extends Model return $this->belongsTo($authenticatable::class); } - if (! class_exists(User::class)) { - throw new Exception('No [' . Filament::namespaceFor('Models\\User') . '] model found. Please bind an authenticatable model to the [Illuminate\\Contracts\\Auth\\Authenticatable] interface in a service provider\'s [register()] method.'); + $userClass = Filament::namespaceFor('Models\\User'); + + if (! class_exists($userClass)) { + throw new Exception('No [' . $userClass . '] model found. Please bind an authenticatable model to the [Illuminate\\Contracts\\Auth\\Authenticatable] interface in a service provider\'s [register()] method.'); } /** @phpstan-ignore-next-line */ - return $this->belongsTo(User::class); + return $this->belongsTo($userClass); } /**