added avatar
This commit is contained in:
parent
b562f3cae8
commit
2dfe0070e2
|
@ -5,12 +5,18 @@ namespace App\Controller\Admin;
|
|||
use App\Entity\Projects;
|
||||
use App\Entity\Quotes;
|
||||
use App\Entity\User;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\UserMenu;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -33,9 +39,29 @@ class DashboardController extends AbstractDashboardController
|
|||
|
||||
public function configureMenuItems(): iterable
|
||||
{
|
||||
yield MenuItem::linkToUrl(label: 'Homepage', icon: 'fa fa-home', url: $this->generateUrl(route: 'app_main'));
|
||||
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);
|
||||
}
|
||||
|
||||
public function configureUserMenu(UserInterface $user): UserMenu
|
||||
{
|
||||
if (!$user instanceof User) {
|
||||
throw new Exception(message: 'Wrong User!');
|
||||
}
|
||||
|
||||
return parent::configureUserMenu(user: $user)
|
||||
->setAvatarUrl(url: $user->getAvatar());
|
||||
}
|
||||
|
||||
|
||||
public function configureActions(): Actions
|
||||
{
|
||||
return parent::configureActions()
|
||||
->add(pageName: Crud::PAGE_INDEX, actionNameOrObject: Action::DETAIL);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue