Black Friday: coupon FRIDAY24 for 40% off Yearly/Lifetime membership! Read more here

Timesheet Form - Weekly Overview and Week Record Edit

Timesheets are a special table where records are often grouped by the week. Let's re-create that and add a custom form that would edit all weekdays simultaneously.

FilamentExamples ThumbBase (52)

Get the Source Code:

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/TimesheetResource.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([
// ...

Next we will work on:

  • Table display to display one week per row
  • Custom Edit page that would edit weekly records
  • Real-time calculations
The FULL tutorial is available after the purchase: in the Readme file of the official repository you would get invited to.
Get the Source Code: All 64 Premium Examples for $99