Export excel for custom model

I am using Custom Model UsersAdmin file is showing in notification for download but when i clicking download button given error
No description
9 Replies
toeknee
toeknee8mo ago
Sounds like a permissions issue to me... did you link storage too?
Yatendra
YatendraOP8mo ago
yes I did
toeknee
toeknee8mo ago
Are you the user who started the download? Have you created an Export Policy Class?
Yatendra
YatendraOP8mo ago
No Ok thanks I try
Yatendra
YatendraOP8mo ago
I am using Laravel 11 Not working still giving error
No description
No description
LeandroFerreira
LeandroFerreira8mo ago
first, active your windows. LOL what about the logic in the view method?
Yatendra
YatendraOP8mo ago
ok sorry for window active message I just want to download excel file. and I am using UsersAmin model for and Admin Panel Provider of filament is <?php class AdminPanelProvider extends PanelProvider { public function panel(Panel $panel): Panel { return $panel ->default() ->id('admin') ->path('admin') ->login(Login::class) ->authGuard('admin') ->brandName('Noritz PROCard Admin Control Panel') ->colors([ 'primary' => Color::Red, ]) ->discoverResources(in: app_path('Filament/Resources'), for: 'App\Filament\Resources') ->discoverPages(in: app_path('Filament/Pages'), for: 'App\Filament\Pages') ->pages([ Pages\Dashboard::class, ]) ->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\Filament\Widgets') ->widgets([ Widgets\AccountWidget::class, Widgets\FilamentInfoWidget::class, ]) ->middleware([ EncryptCookies::class, AddQueuedCookiesToResponse::class, StartSession::class, AuthenticateSession::class, ShareErrorsFromSession::class, VerifyCsrfToken::class, SubstituteBindings::class, DisableBladeIconComponents::class, DispatchServingFilamentEvent::class, ]) ->databaseNotifications() ->authMiddleware([ Authenticate::class, ]); } }
No description
Yatendra
YatendraOP8mo ago
and app service provider class AppServiceProvider extends ServiceProvider { /** * Register any application services. */ // protected $policies = [ // Export::class => ExportPolicy::class, // ];
public function register(): void { $this->app->bind(Authenticatable::class, UsersAdmin::class); } <?php namespace App\Policies; use App\Models\UsersAdmin; use Filament\Actions\Exports\Models\Export; class ExportPolicy { public function view(UsersAdmin $user, Export $export): bool { dd('sssssssssssssss'); return $export->user()->is($user); } }
Want results from more Discord servers?
Add your server