Chapters
40 Chapters
|
4:19:16
|
Login to bookmark this video
-
Course Code
Subscribe to download the code!
Subscribe to download the code!
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Subtitles
Subscribe to download the subtitles!
Subscribe to download the subtitles!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
02.
Admin Dashboard
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Subscribe to jump to this part in the video!
This tutorial is built on Symfony 6 but works great on Symfony 7!
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": ">=8.2.0",
"ext-ctype": "*",
"ext-iconv": "*",
"composer/package-versions-deprecated": "^1.11", // 1.11.99.4
"doctrine/doctrine-bundle": "^2.1", // 2.5.5
"doctrine/doctrine-migrations-bundle": "^3.0", // 3.2.1
"doctrine/orm": "^2.7", // 2.10.4
"easycorp/easyadmin-bundle": "^4.0", // v4.0.2
"handcraftedinthealps/goodby-csv": "^1.4", // 1.4.0
"knplabs/knp-markdown-bundle": "dev-symfony6", // dev-symfony6
"knplabs/knp-time-bundle": "^1.11", // 1.17.0
"sensio/framework-extra-bundle": "^6.0", // v6.2.5
"stof/doctrine-extensions-bundle": "^1.4", // v1.7.0
"symfony/asset": "6.0.*", // v6.0.1
"symfony/console": "6.0.*", // v6.0.2
"symfony/dotenv": "6.0.*", // v6.0.2
"symfony/flex": "^2.0.0", // v2.4.5
"symfony/framework-bundle": "6.0.*", // v6.0.2
"symfony/mime": "6.0.*", // v6.0.2
"symfony/monolog-bundle": "^3.0", // v3.7.1
"symfony/runtime": "6.0.*", // v6.0.0
"symfony/security-bundle": "6.0.*", // v6.0.2
"symfony/stopwatch": "6.0.*", // v6.0.0
"symfony/twig-bundle": "6.0.*", // v6.0.1
"symfony/ux-chartjs": "^2.0", // v2.0.1
"symfony/webpack-encore-bundle": "^1.7", // v1.13.2
"symfony/yaml": "6.0.*", // v6.0.2
"twig/extra-bundle": "^2.12|^3.0", // v3.3.7
"twig/twig": "^2.12|^3.0" // v3.3.7
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.3", // 3.4.1
"symfony/debug-bundle": "6.0.*", // v6.0.2
"symfony/maker-bundle": "^1.15", // v1.36.4
"symfony/var-dumper": "6.0.*", // v6.0.2
"symfony/web-profiler-bundle": "6.0.*", // v6.0.2
"zenstruck/foundry": "^1.1" // v1.16.0
}
}
28 Comments
When im trying to log in with email admin@example.com and password adminpass i receive message "Invalid credentials". How to fix it?
Hey Kacper G.
Can you double-check that such user exist? I believe you forgot to load the data fixtures
Cheers!
Thanks for reply. Yea. That was it, I forgot to use command "symfony console doctrine:fixtures:load"
I’m trying to recreate the securing EasyAdmin process from scratch - in other words I’m not using the provided project files but creating it by myself from scratch taking from this tutorial the best I can. And now I’m stuck, because you’re using the SensioFrameworkExtraBundle and the official Symfony docs are saying:
So that’s a no-go for me ;-)
It would be great to have this tutorial really about EasyAdmin from the beginning, without shortcuts like preinstalled bundles and precreated entities.
Hey websafe,
Just skip that bundle :) In the earlier versions of Symfony that was a standard bundle in case you wanted to use PHP annotations/attributes, but now it's part of the core packages, i.e. use
Symfony\Component\Routing\Annotation\RouteActually, we have a script/video note on this chapter:
I hope this helps! Let us know if you still have problems with following this course on a newer Symfony version.
This tutorial is really about the EasyAdmin bundle... but because that's just a bundle it affects other Symfony parts like routing, etc. and can't be standalone without a Symfony application :)
Cheers!
Hi guys!
I think I've missed something during the course: after adding #IsGranted attribute to the dashboard route it does not redirect me anywhere, just fails with "Full authentication is required to access this resource" exception.
Could you please point me to the place in the course where that redirect to login page as added.
Thanks
Hey @Vitalii-R
Did you download the course code or did you start from scratch?
Symfony redirects you automatically to the login page when you ask for full authentication, or when you are anonymous and try to visit a secured page
Hello.
With the new version of Symfony 6.2, you can generate a dashboard,
but all the data for Secure
#[IsGranted('ROLE_ADMIN')]Login-Template,src/DataFixtures/AppFixtures.phpare missing, ... ,
and the
sensio/framework-extra-bundleis abandonedDo you have an update on this or what is the best way to go about it?
Best regards
Tom
Hey Tom,
This is the latest version of the EasyAdmin tutorial. Yeah, in Symfony 6.2 the PHP attributes like
#[IsGranted('ROLE_ADMIN')]you mentioned should work out of the box now, so you don't need to install that extrasensio/framework-extra-bundleanymore.We're going to add a note to mention this, thanks for pointing into this!
Also, we do recommend you follow the course by downloading the course code and starting from the start/ folder inside the downloaded archive. This way you will have the exact same versions of dependencies we have in the video. But if you want to follow it on a fresher Symfony version - you might require to do some extra work because of some changes in the dependencies. But don't worry, if you get stuck somewhere following it on Symfony 6.2 - let us know in the comments and we will help!
Cheers!
The workaround for the new welcome page isn't working anymore.
I'm getting 404 errors for fonts used by easyadmin.
It's searching for fonts in the public/bundles/easyadmin/fonts folder for fonts that are actually in the folder but have the wrong hashes
"REQUES Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET https://localhost:8000/bundles/easyadmin/fonts/fa-brands-400.13685372.ttf" (from "https://localhost:8000/bundles/easyadmin/app.css")" at C:\Users\*****\Desktop\code-easyadminbundle\finish\vendor\symfony\http-kernel\EventListener\RouterListener.php line 130"
That's one of the errors in my console.
I'm even trying the "finished" version of the course code, and the admin dashboard looks like its not loading any styles from easyadmin at all, the whole page is smooshed to the left, there are no font awesome icons, the menu is a bunch of blue text floating over a giant picture of a guy and a playing card
Hello, what patter implement this approach ?
Hey Maxim,
I'm not sure you can highlight a specific pattern for this. Well, the EA dashboard is just a Symfony controller first of all. And it implements some interfaces that helps to do this in the standardized (regulated) way, but it's core PHP concepts, not separate patterns.
I hope this helps!
Cheers!
Hey Victor,
Sorry but could you help me
The easy admin assets aren't loading and the none of the javascript is firing. I'm getting 404 errors for woff2 ttf and woff fonts
Hey Nick!
Hm, could you make sure you installed the bundle assets? For it, please, rerun:
$ bin/console assets:install
Then, try to clear the Symfony cache. Also probably do a force reload in your browser just in case or open the website in Incognito.
Cheers!
Hi I have the same problem here. I can't see the "Dashboard" link.
And I'm also stucked on the "Welcome to EasyAdmin 4" pag.
Hey WilcoS
See my answer below =)
Cheers!
Hi,
I don't see dashboard as yours.
I see "Welcome to EasyAdmin 4" - in the center of page without aside "Dashboard" and user's login (user icon and user name).
Could you check? I have EasyAdmin 4.0.3
Thank you.
I've got something like you if generate url.
public function index(): Response
{
// return parent::index();
$url = $this->adminUrlGenerator
->setController(QuestionCrudController::class)
->generateUrl();
return $this->redirect($url);
}
And one more solution, create own template:
(From docs: https://symfony.com/bundles...
{# templates/admin/my-custom-page.html.twig #}
{% extends '@EasyAdmin/page/content.html.twig' %}
{% block content_title %}The Title of the Page{% endblock %}
{% block page_actions %}
Some Action
{% endblock %}
{% block main %}
<table class="datagrid">
<thead>
<tr>
<td>Some Column</td>
<td>Another Column</td>
</tr>
</thead>
<tbody>
</tbody>
</table>
{% endblock %}
Hey Ruslan
Yeah You are right, there was a change in welcome page, so you need to implement custom dashboard page for dashboard! Checkout my answer below =)
Cheers!
Thank you.
Hello and thanks for this new tutorial!
I'm stucked on the "Welcome to EasyAdmin 4" page. I even can't see the "Dashboard" link.
Any idea?
Hey @Tomas
Yeah that's a weird state, caused by latest EA version, welcome page was changed so to see link you should do some additional work. Create a template inside
templates/directory with namedashboard.html.twigand put inside following contentNow in
src/Controller/Admin/DashboardController.phpchangeindex()this waynow you will get an empty page for dashboard
Cheers!
Thank you so much
Yes, it's working! Thanks a lot. That's from EA 4.0.0 ? I'm running EA 4.0.3
As I see in the EA changelog, new default Dashboard page was introduced in version 4.0.3
Thomas, sorry for the confusion! Vladimir thanks a lot for helping people and I'm sorry this updated "Welcome Page" was introduced just when you produced the video with the old "Welcome Page".
This past weekend we've tweaked the "Welcome Page" again to hopefully be more clear. It will be part of the next stable release. See https://github.com/EasyCorp...
Don't worry about it, that's all fine. You're doing an amazing job!
Hey Javier E.
NP! It happens =) We are here to help people with issues =)
Cheers!
"Houston: no signs of life"
Start the conversation!