Filament Import Fails , Using `Admin` Model instead of `User`
--> Full Issue description in the text file in comments
Brief:
What I am trying to do:
- Import a CSV into a Filament resource via ImportAction (queued ImportCsv job), updating existing DailyGift rows by day.
What I did:
- Implemented a Filament Importer with columns (day, amount, coin_id).
- resolveRecord() returns the DailyGift by day or throws RowImportFailedException if missing.
- imports row is created with user_id = 1.
- Admin panel uses the admin guard. App\Models\Admin::find(1) returns a model; App\Models\User::find(1) is null.
- Queue driver: database; using queue:work.
My issue/the error:
- The ImportCsv job keeps failing and retrying with: Illuminate\Auth\SessionGuard::login(): Argument #1 ($user) must be of type Authenticatable, null given
- Stack shows Filament tries to log in the initiating user, but it resolves to null at runtime. This suggests the job authenticates via the default web/users provider instead of the admin/admins provider, so retrieveById(1) returns null. I can’t globally switch the default guard (other jobs rely on it).
Solution:Jump to solution
After some research i have solved this problem using :
```php
// AppServiceProvider
use Illuminate\Support\Facades\Route;
...
11 Replies
Why did you repeat your description in the .txt file? That makes it harder to read.
Also it would help with syntax highlighting
thanks , i edited the .txt file
Next time, please just post the code here too. You can use markdown and Discord will highlight it.
I think what you need to do is bind the Admin model to the Authenticatable.
Put this into a service provider:
$this->app->bind(Authenticatable::class, Admin::class);
GitHub
Implementing AUTH_MODEL for Import & Export Enhancement · filament...
Today I was confused when using the database on QUEUE_CONNECTION Import & Export Job always failed, after I investigated because \App\Models\User was not found. FYI: I'm using \App\Domains...
thanx, i will keep that in mind
and for the
i have already done that and it still getting me the same error
Did you restart the queue?
yeah i have restarted the queue and the server
also to be sure no cache or anything
Is this local or in production? Could it be OpCache?
this is on local and no i don't think it is OpCache problem neither
Solution
After some research i have solved this problem using :
Also i was incorrectly importing Authenticatable at