© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
7 replies
Chanda

Listing records from a custom page:

Hello I want to create a custom page for listing records only. I don't want a full resource but I only want a page to list records which will be linked to a certain resource which has already benn created, so I proceeded to create my bew resource as per docs as:
php artisan make:filament-page ActiveLoans --resource=LoanResource --type=custom
php artisan make:filament-page ActiveLoans --resource=LoanResource --type=custom

Upon creating my custom page I registered my custom page route in the
`LoanResource
`LoanResource
file class under getPages as shown:
public static function getPages(): array
    {
        return [
            'active' => Pages\ActiveLoans::route('/active'),
            'index' => Pages\ListLoans::route('/'),
            'create' => Pages\CreateLoan::route('/create'),
            'view' => Pages\ViewLoan::route('/{record}'),
            'edit' => Pages\EditLoan::route('/{record}/edit'),
            
        ];
    }
public static function getPages(): array
    {
        return [
            'active' => Pages\ActiveLoans::route('/active'),
            'index' => Pages\ListLoans::route('/'),
            'create' => Pages\CreateLoan::route('/create'),
            'view' => Pages\ViewLoan::route('/{record}'),
            'edit' => Pages\EditLoan::route('/{record}/edit'),
            
        ];
    }

I then went to my newly created custom page class component and added the following files:
<?php

namespace App\Filament\Resources\LoanResource\Pages;
use Illuminate\Support\Collection;
use App\Filament\Resources\LoanResource;
use App\Models\Loan;
use Filament\Resources\Pages\Page;

class ActiveLoans extends Page
{
    protected static string $resource = LoanResource::class;

    protected static string $view = 'filament.resources.loan-resource.pages.active-loans';


    public function getViewData(): array {
        $data = Loan::get();
    
        if ($data instanceof Collection) {
            return $data->toArray();
        }
    
       
    }
}
<?php

namespace App\Filament\Resources\LoanResource\Pages;
use Illuminate\Support\Collection;
use App\Filament\Resources\LoanResource;
use App\Models\Loan;
use Filament\Resources\Pages\Page;

class ActiveLoans extends Page
{
    protected static string $resource = LoanResource::class;

    protected static string $view = 'filament.resources.loan-resource.pages.active-loans';


    public function getViewData(): array {
        $data = Loan::get();
    
        if ($data instanceof Collection) {
            return $data->toArray();
        }
    
       
    }
}

The corresponding laravel blade for the custom class looks like this:
<x-filament-panels::page>
    {{ $this->data }}
</x-filament-panels::page>
<x-filament-panels::page>
    {{ $this->data }}
</x-filament-panels::page>

However each time I access my route am getting the following exception :
Property [$data] not found on component: [app.filament.resources.loan-resource.pages.active-loans]
Property [$data] not found on component: [app.filament.resources.loan-resource.pages.active-loans]

What am I missing?
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Table not Listing All Records
FilamentFFilament / ❓┊help
6mo ago
Get all selected records inside a custom page
FilamentFFilament / ❓┊help
3y ago
how do i create a listing page with custom query ?
FilamentFFilament / ❓┊help
3y ago
Sending data from a custom page to another custom page
FilamentFFilament / ❓┊help
8mo ago