46 lines
1.4 KiB
PHP
46 lines
1.4 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace App\Infrastructure\Http\Controller\Admin;
|
||
|
|
|
||
|
|
use App\Domain\Log\LogEntry;
|
||
|
|
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
|
||
|
|
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
|
||
|
|
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
|
||
|
|
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||
|
|
use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
|
||
|
|
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
|
||
|
|
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
||
|
|
|
||
|
|
/** @extends AbstractCrudController<LogEntry> */
|
||
|
|
final class LogEntryCrudController extends AbstractCrudController
|
||
|
|
{
|
||
|
|
public static function getEntityFqcn(): string
|
||
|
|
{
|
||
|
|
return LogEntry::class;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function configureCrud(Crud $crud): Crud
|
||
|
|
{
|
||
|
|
return $crud
|
||
|
|
->setEntityLabelInSingular('Log Entry')
|
||
|
|
->setEntityLabelInPlural('Log Entries')
|
||
|
|
->setDefaultSort(['loggedAt' => 'DESC']);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function configureActions(Actions $actions): Actions
|
||
|
|
{
|
||
|
|
return $actions->disable(Action::NEW, Action::EDIT, Action::DELETE);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function configureFields(string $pageName): iterable
|
||
|
|
{
|
||
|
|
yield DateTimeField::new('loggedAt', 'Time');
|
||
|
|
yield TextField::new('channel');
|
||
|
|
yield IntegerField::new('level');
|
||
|
|
yield TextField::new('levelName', 'Level');
|
||
|
|
yield TextField::new('message');
|
||
|
|
}
|
||
|
|
}
|