This project demonstrates how to manage expenses/income by categories and shows charts with numbers on the dashboard.
This example project has two navigation groups:
In these groups, we have Filament Resource to manage expense or income and their categories.
These resources have identical forms and tables. The table is sorted by entry date
in descending order.
Here is the code for the expense and income form and table:
public static function form(Form $form): Form{ return $form ->schema([ Forms\Components\DatePicker::make('entry_date') ->required(), Forms\Components\TextInput::make('amount') ->numeric() ->required() ->step('0.01'), Forms\Components\TextInput::make('description') ->columnSpanFull(), ]);} public static function table(Table $table): Table{ return $table ->columns([ Tables\Columns\TextColumn::make('entry_date') ->date(), Tables\Columns\TextColumn::make('amount') ->money(), Tables\Columns\TextColumn::make('incomeCategory.name'), ]) ->filters([ Tables\Filters\TrashedFilter::make(), ]) ->actions([ Tables\Actions\EditAction::make(), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ Tables\Actions\DeleteBulkAction::make(), Tables\Actions\ForceDeleteBulkAction::make(), Tables\Actions\RestoreBulkAction::make(), ]), ]) ->defaultSort('entry_date', 'desc');}
And here is the code for...