Skip to content

Commit

Permalink
Add titles to the admin
Browse files Browse the repository at this point in the history
  • Loading branch information
artandor committed Apr 2, 2022
1 parent 9f58207 commit c067583
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Controller/Admin/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Controller\Admin;

use App\Entity\Platform;
use App\Entity\TitleHistory;
use App\Entity\User;
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
Expand Down Expand Up @@ -34,6 +35,7 @@ public function configureMenuItems(): iterable
yield MenuItem::linktoDashboard('Dashboard', 'fa fa-home');
yield MenuItem::linktoRoute('Back to the website', 'fas fa-globe', 'home');
yield MenuItem::linkToCrud('Users', 'fa fa-user', User::class);
yield MenuItem::linkToCrud('Stream Titles', 'fa fa-camera', TitleHistory::class);
yield MenuItem::linkToCrud('Platforms', 'fa fa-bars', Platform::class);
yield MenuItem::linktoRoute('Users Stats', 'fa fa-chart-bar', 'admin_user_stats');
}
Expand Down
38 changes: 38 additions & 0 deletions src/Controller/Admin/TitleHistoryCrudController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace App\Controller\Admin;

use App\Entity\TitleHistory;
use EasyCorp\Bundle\EasyAdminBundle\Config\Filters;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\DateField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;

class TitleHistoryCrudController extends AbstractCrudController
{
public static function getEntityFqcn(): string
{
return TitleHistory::class;
}

public function configureFields(string $pageName): iterable
{
return [
IdField::new('id'),
TextField::new('title'),
TextField::new('category'),
AssociationField::new('creator'),
DateField::new('createdAt'),
];
}

public function configureFilters(Filters $filters): Filters
{
return $filters
->add('title')
->add('createdAt')
->add('creator');
}
}

0 comments on commit c067583

Please sign in to comment.