-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
namespace App\Filament\Resources; | ||
|
||
use App\Filament\Resources\ActivityResource\Pages; | ||
use App\Filament\Resources\ActivityResource\RelationManagers; | ||
use App\Models\Activity; | ||
use Filament\Forms; | ||
use Filament\Forms\Form; | ||
use Filament\Resources\Resource; | ||
use Filament\Tables; | ||
use Filament\Tables\Columns\Layout\Stack; | ||
use Filament\Tables\Table; | ||
use Illuminate\Database\Eloquent\Builder; | ||
use Illuminate\Database\Eloquent\SoftDeletingScope; | ||
|
||
class ActivityResource extends Resource | ||
{ | ||
protected static ?string $model = Activity::class; | ||
|
||
protected static ?string $navigationIcon = 'heroicon-o-bars-arrow-down'; | ||
|
||
protected static ?int $navigationSort = 2; | ||
|
||
public static function getNavigationGroup(): ?string | ||
{ | ||
return __('Access Management'); | ||
} | ||
|
||
public static function table(Table $table): Table | ||
{ | ||
return $table | ||
->heading(__('Activity Logs')) | ||
->description(__('A log of all activity in the system.')) | ||
->columns([ | ||
Stack::make([ | ||
Tables\Columns\TextColumn::make('description_formatted'), | ||
Tables\Columns\TextColumn::make('created_at') | ||
->dateTime() | ||
->color('warning'), | ||
]), | ||
]) | ||
->filters([ | ||
// | ||
]); | ||
} | ||
|
||
public static function getPages(): array | ||
{ | ||
return [ | ||
'index' => Pages\ListActivities::route('/'), | ||
]; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/Filament/Resources/ActivityResource/Pages/ListActivities.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace App\Filament\Resources\ActivityResource\Pages; | ||
|
||
use App\Filament\Resources\ActivityResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\ListRecords; | ||
use Illuminate\Contracts\Pagination\Paginator; | ||
use Illuminate\Database\Eloquent\Builder; | ||
|
||
class ListActivities extends ListRecords | ||
{ | ||
protected static string $resource = ActivityResource::class; | ||
|
||
protected function paginateTableQuery(Builder $query): Paginator | ||
{ | ||
return $query->simplePaginate(($this->getTableRecordsPerPage() === 'all') ? $query->count() : $this->getTableRecordsPerPage()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters