mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
Fix possibly differing model-class
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user