refactored
This commit is contained in:
parent
064749a8f9
commit
17069cf550
@ -2,42 +2,40 @@
|
||||
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Entity\Section;
|
||||
use App\Entity\Projects;
|
||||
use App\Entity\Quotes;
|
||||
use App\Entity\User;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use App\Entity\User;
|
||||
use App\Entity\Blog;
|
||||
use App\Entity\Comment;
|
||||
|
||||
|
||||
/**
|
||||
* Class DashboardController
|
||||
* @package App\Controller\Admin
|
||||
*
|
||||
*/
|
||||
class DashboardController extends AbstractDashboardController
|
||||
{
|
||||
#[Route('/admin', name: 'admin')]
|
||||
#[isGranted(data: 'ROLE_ADMIN')]
|
||||
#[Route(path: '/admin', name: 'admin')]
|
||||
public function index(): Response
|
||||
{
|
||||
return parent::index();
|
||||
//return parent::index();
|
||||
return $this->render(view: 'admin/index.html.twig');
|
||||
}
|
||||
|
||||
public function configureDashboard(): Dashboard
|
||||
{
|
||||
return Dashboard::new()
|
||||
->setTitle('24unix');
|
||||
->setTitle(title: '24unix Admin');
|
||||
}
|
||||
|
||||
public function configureMenuItems(): iterable
|
||||
{
|
||||
yield MenuItem::linktoRoute('Back to the website', 'fas fa-home', 'blogs');
|
||||
yield MenuItem::linktoDashboard('Dashboard', 'fas fa-tachometer-alt');
|
||||
yield MenuItem::linkToCrud('User', 'fas fa-user', User::class);
|
||||
yield MenuItem::linkToCrud('Sections', 'fas fa-book', Section::class);
|
||||
yield MenuItem::linkToCrud('Blogs', 'fas fa-blog', Blog::class);
|
||||
yield MenuItem::linkToCrud('Comments', 'fas fa-comments', Comment::class);
|
||||
yield MenuItem::linkToDashboard(label: 'Dashboard', icon: 'fa fa-dashboard');
|
||||
yield MenuItem::linkToCrud(label: 'Projects', icon: 'fa fa-file-code-o', entityFqcn: Projects::class);
|
||||
yield MenuItem::linkToCrud(label: 'Users', icon: 'fa fa-users', entityFqcn: User::class);
|
||||
yield MenuItem::linkToCrud(label: 'Quotes', icon: 'fa fa-quote-left', entityFqcn: Quotes::class);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user