Unable to download export file
Hi. I am using Filament v3 and Stanc Multi-tenancy v4.
If I use Filament export functionality, I keep having :
No [App\Models\User] model found. Please bind an authenticatable model to the [Illuminate\Contracts\Auth\Authenticatable] interface in a service provider's [register()] method
However, I am using two different models. For my central app : App\Models\Central\User and for my tenants I am using : App\Models\Tenant\User
The export file is generated in storage repositories. The issue seems mainly related to generating the dowload url.
Did anyone solved that user model binding customisation ?
Thanks
2 Replies
You need to define the model in the exporter
Well, I did it. Here is my exporter : <?php
namespace App\Filament\Exports;
use App\Models\Central\Country;
use App\Models\Central\User;
use Filament\Actions\Exports\ExportColumn;
use Filament\Actions\Exports\Exporter;
use Filament\Actions\Exports\Models\Export;
class CountryExporter extends Exporter
{
protected static ?string $model = Country::class;
public static function getColumns(): array
{
return [
ExportColumn::make('long_name'),
ExportColumn::make('short_name'),
];
}
public static function getCompletedNotificationBody(Export $export): string
{
$body = 'Your company export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
if ($failedRowsCount = $export->getFailedRowsCount()) {
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
}
return $body;
}
Hi, anyone faced the issue ? When using standard import/export action, the tenancy middleware is not being applied when downloading an export...