Chanda
Chanda
FFilament
Created by Chanda on 2/21/2024 in #❓┊help
Page Expired
I have this error in Filament of which each time I try to Log out I am facing the page expired Issue.
1 replies
FFilament
Created by Chanda on 12/7/2023 in #❓┊help
form-field
I have a column in Loans table called loan_agreement_file_path which stores the path of a file. Now what I want is to show the file link of this file in a table list such that when a user clicks on it he/she can download the file. This is what I have a tried but its not working:
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('loan_agreement_file_path')
->formatStateUsing(function (string $state): string {
return url("<a href=\"" . asset($state) . "\">Loan Agreement Form</a>");
})
->sortable(),

....................................
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('loan_agreement_file_path')
->formatStateUsing(function (string $state): string {
return url("<a href=\"" . asset($state) . "\">Loan Agreement Form</a>");
})
->sortable(),

....................................
Any Ideas?
7 replies
FFilament
Created by Chanda on 11/26/2023 in #❓┊help
My Custom Pages Routes Suddenly throwing 404
Hey I have created a few custom pages and linked them to the model resource. Also I have registered the routes of those custom pages in the Actual resource under getPages as :
public static function getPages(): array
{
return [


'index' => Pages\ListLoans::route('/'),
'active' => Pages\ActiveLoans::route('/active'),
'pending' => Pages\PendingLoans::route('/pending'),
'denied' => Pages\DeniedLoans::route('/denied'),
'defaulted' => Pages\DefaultedLoans::route('/defaulted'),
'create' => Pages\CreateLoan::route('/create'),
'view' => Pages\ViewLoan::route('/{record}'),
'edit' => Pages\EditLoan::route('/{record}/edit'),

];
}
public static function getPages(): array
{
return [


'index' => Pages\ListLoans::route('/'),
'active' => Pages\ActiveLoans::route('/active'),
'pending' => Pages\PendingLoans::route('/pending'),
'denied' => Pages\DeniedLoans::route('/denied'),
'defaulted' => Pages\DefaultedLoans::route('/defaulted'),
'create' => Pages\CreateLoan::route('/create'),
'view' => Pages\ViewLoan::route('/{record}'),
'edit' => Pages\EditLoan::route('/{record}/edit'),

];
}
I have added the navigation Icon to these custom groups. Now the problem is each time I try to access the route am getting a 404.
3 replies
FFilament
Created by Chanda on 11/25/2023 in #❓┊help
Adding Custom Page in Navigation
I have created a custom page which I have added in config as:
public function panel(Panel $panel): Panel
{
return $panel
->navigationItems([
NavigationItem::make('Active Loans')
->url('active')
->icon('fas-coins')
->isActiveWhen(fn (): bool => request()->routeIs('filament.admin.resources.loans.active')),

])
//other lines of codes here
public function panel(Panel $panel): Panel
{
return $panel
->navigationItems([
NavigationItem::make('Active Loans')
->url('active')
->icon('fas-coins')
->isActiveWhen(fn (): bool => request()->routeIs('filament.admin.resources.loans.active')),

])
//other lines of codes here
What I want is to add this now to the NavigationGroup. Its appearing on the sidebar but I want it to appear under NavigationGroup. I have tried to add the navigation group inside the custom page itself as: protected static ?string $navigationGroup = 'Loans'; but its not working
4 replies
FFilament
Created by Chanda on 11/24/2023 in #❓┊help
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 Upon creating my custom page I registered my custom page route in the `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] What am I missing?
8 replies