Timesheet Form - Weekly Overview and Week Record Edit
Filament 4/5
Also available in
Filament 3 version
This project illustrates creating fully customized forms dynamically generated from database values.
Get the Source Code:
Only This Example
$9
One-time payment
Full source code for Timesheet Form - Weekly Overview and Week Record Edit
Downloadable ZIP file with the source code
Lifetime access to this example
Sign in with GitHub to buy
Sign in first, then complete your $9 checkout.
Best value — all 178 examples
View membership plans
FilamentExamples Membership
$99
/year
or
$199
lifetime
Access to code of all 178 examples
Future new examples and updates included
FilaCheck Pro package licence included
MCP server included
30-day money-back guarantee
How it works
First, in the table, we only show the weeks. To achieve this, we must modify the table query. To show value in the tables column, we set it as a default value.
NOTICE: Syntax for the table is for MySQL.
app/Filament/Resources/Timesheets/Tables/TimesheetsTable.php:
public static function table(Table $table): Table{ return $table ->modifyQueryUsing(function (Builder $query) { $query->selectRaw('id, DATE_FORMAT(date, "%Y-%m-%d") as week_start') ->whereRaw('DAYOFWEEK(date) = 2') // Filter for Mondays only ->distinct() ->groupBy('week_start', 'date', 'id'); }) ->columns([ TextColumn::make('week') ->default(function (Timesheet $record) { return "Week {$record->week_start->format('Y m d')} - {$record->week_start->endOfWeek()->format('Y m d')}"; }), ]) // ...}
On the week_start, we can use Carbon features because the Model casts it to a date.
The FULL tutorial is available after the purchase: in the Readme file of the official
repository you would get invited to.