47 lines
1.7 KiB
PHP
47 lines
1.7 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace App\Controller\Admin;
|
||
|
|
||
|
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\Attribute\Route;
|
||
|
|
||
|
class DashboardController extends AbstractDashboardController
|
||
|
{
|
||
|
#[Route('/admin', name: 'admin')]
|
||
|
public function index(): Response
|
||
|
{
|
||
|
return parent::index();
|
||
|
|
||
|
// Option 1. You can make your dashboard redirect to some common page of your backend
|
||
|
//
|
||
|
// $adminUrlGenerator = $this->container->get(AdminUrlGenerator::class);
|
||
|
// return $this->redirect($adminUrlGenerator->setController(OneOfYourCrudController::class)->generateUrl());
|
||
|
|
||
|
// Option 2. You can make your dashboard redirect to different pages depending on the user
|
||
|
//
|
||
|
// if ('jane' === $this->getUser()->getUsername()) {
|
||
|
// return $this->redirect('...');
|
||
|
// }
|
||
|
|
||
|
// Option 3. You can render some custom template to display a proper dashboard with widgets, etc.
|
||
|
// (tip: it's easier if your template extends from @EasyAdmin/page/content.html.twig)
|
||
|
//
|
||
|
// return $this->render('some/path/my-dashboard.html.twig');
|
||
|
}
|
||
|
|
||
|
public function configureDashboard(): Dashboard
|
||
|
{
|
||
|
return Dashboard::new()
|
||
|
->setTitle('داشبورد مدیریت محتوای حسابیکس');
|
||
|
}
|
||
|
|
||
|
public function configureMenuItems(): iterable
|
||
|
{
|
||
|
yield MenuItem::linkToDashboard('Dashboard', 'fa fa-home');
|
||
|
// yield MenuItem::linkToCrud('The Label', 'fas fa-list', EntityClass::class);
|
||
|
}
|
||
|
}
|