setup admin interface
This commit is contained in:
parent
dfff8adb8f
commit
af10620337
8 changed files with 561 additions and 57 deletions
34
src/Controller/Admin/DashboardController.php
Normal file
34
src/Controller/Admin/DashboardController.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Entity\User;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class DashboardController extends AbstractDashboardController
|
||||
{
|
||||
/**
|
||||
* @Route("/admin", name="admin")
|
||||
*/
|
||||
public function index(): Response
|
||||
{
|
||||
return parent::index();
|
||||
}
|
||||
|
||||
public function configureDashboard(): Dashboard
|
||||
{
|
||||
return Dashboard::new()
|
||||
->setTitle('Plant Exchange');
|
||||
}
|
||||
|
||||
public function configureMenuItems(): iterable
|
||||
{
|
||||
yield MenuItem::linktoRoute('Back to the website', 'fas fa-arrow-left', 'homepage');
|
||||
yield MenuItem::linktoDashboard('Dashboard', 'fa fa-home');
|
||||
yield MenuItem::linkToCrud('User', 'fas fa-user', User::class);
|
||||
}
|
||||
}
|
25
src/Controller/Admin/UserCrudController.php
Normal file
25
src/Controller/Admin/UserCrudController.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Entity\User;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||||
|
||||
class UserCrudController extends AbstractCrudController
|
||||
{
|
||||
public static function getEntityFqcn(): string
|
||||
{
|
||||
return User::class;
|
||||
}
|
||||
|
||||
/*
|
||||
public function configureFields(string $pageName): iterable
|
||||
{
|
||||
return [
|
||||
IdField::new('id'),
|
||||
TextField::new('title'),
|
||||
TextEditorField::new('description'),
|
||||
];
|
||||
}
|
||||
*/
|
||||
}
|
Reference in a new issue