2
2
3
3
namespace DutchCodingCompany \FilamentDeveloperLogins ;
4
4
5
- use App \Models \User ;
6
5
use Closure ;
7
6
use DutchCodingCompany \FilamentDeveloperLogins \Exceptions \ImplementationException ;
8
7
use Filament \Contracts \Plugin ;
11
10
use Filament \Panel ;
12
11
use Filament \Support \Concerns \EvaluatesClosures ;
13
12
use Illuminate \Contracts \Auth \Authenticatable ;
13
+ use App \Models \User ;
14
14
15
15
class FilamentDeveloperLoginsPlugin implements Plugin
16
16
{
17
17
use EvaluatesClosures, HasColumns;
18
18
19
+ /**
20
+ * @var class-string<\Illuminate\Database\Eloquent\Model&\Illuminate\Contracts\Auth\Authenticatable>
21
+ */
22
+ public string $ modelClass = '' ;
23
+
19
24
public Closure | bool $ enabled = false ;
20
25
21
26
public Closure | bool $ switchable = true ;
@@ -31,10 +36,10 @@ class FilamentDeveloperLoginsPlugin implements Plugin
31
36
32
37
public string $ column = 'email ' ;
33
38
34
- /**
35
- * @var class-string<\Illuminate\Database\Eloquent\Model&\Illuminate\Contracts\Auth\Authenticatable>
36
- */
37
- public string $ modelClass = User::class;
39
+ public function __construct ()
40
+ {
41
+ $ this -> modelClass = config ( ' auth.providers.users.model ' ) ?? User::class;
42
+ }
38
43
39
44
public function getId (): string
40
45
{
@@ -153,10 +158,6 @@ public function getColumn(): string
153
158
*/
154
159
public function modelClass (string $ modelClass ): static
155
160
{
156
- if (! is_a ($ modelClass , Authenticatable::class, true )) {
157
- throw new ImplementationException ('The model class must implement the "\Illuminate\Contracts\Auth\Authenticatable" interface. ' );
158
- }
159
-
160
161
$ this ->modelClass = $ modelClass ;
161
162
162
163
return $ this ;
0 commit comments