提交 7d3f6f0b 编写于 作者: T teebbstudios

PostCrudController

上级 4b3a1fe5
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "1416acda7587c1937dc3a6d82aa8cfef",
"content-hash": "563bee71502744ec753ed238c7e1f5d8",
"packages": [
{
"name": "composer/package-versions-deprecated",
......@@ -4029,6 +4029,95 @@
],
"time": "2021-05-27T12:28:50+00:00"
},
{
"name": "symfony/mime",
"version": "v5.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/mime.git",
"reference": "47dd7912152b82d0d4c8d9040dbc93d6232d472a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/mime/zipball/47dd7912152b82d0d4c8d9040dbc93d6232d472a",
"reference": "47dd7912152b82d0d4c8d9040dbc93d6232d472a",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1",
"symfony/polyfill-intl-idn": "^1.10",
"symfony/polyfill-mbstring": "^1.0",
"symfony/polyfill-php80": "^1.15"
},
"conflict": {
"egulias/email-validator": "~3.0.0",
"phpdocumentor/reflection-docblock": "<3.2.2",
"phpdocumentor/type-resolver": "<1.4.0",
"symfony/mailer": "<4.4"
},
"require-dev": {
"egulias/email-validator": "^2.1.10|^3.1",
"phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
"symfony/dependency-injection": "^4.4|^5.0",
"symfony/property-access": "^4.4|^5.1",
"symfony/property-info": "^4.4|^5.1",
"symfony/serializer": "^5.2"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Mime\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Allows manipulating MIME messages",
"homepage": "https://symfony.com",
"keywords": [
"mime",
"mime-type"
],
"support": {
"source": "https://github.com/symfony/mime/tree/v5.3.2"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-06-09T10:58:01+00:00"
},
{
"name": "symfony/options-resolver",
"version": "v5.3.0",
......@@ -4363,6 +4452,99 @@
],
"time": "2021-05-24T10:04:56+00:00"
},
{
"name": "symfony/polyfill-intl-idn",
"version": "v1.23.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-idn.git",
"reference": "65bd267525e82759e7d8c4e8ceea44f398838e65"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/65bd267525e82759e7d8c4e8ceea44f398838e65",
"reference": "65bd267525e82759e7d8c4e8ceea44f398838e65",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=7.1",
"symfony/polyfill-intl-normalizer": "^1.10",
"symfony/polyfill-php72": "^1.10"
},
"suggest": {
"ext-intl": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Intl\\Idn\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Laurent Bassin",
"email": "laurent@bassin.info"
},
{
"name": "Trevor Rowbotham",
"email": "trevor.rowbotham@pm.me"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"idn",
"intl",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.23.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-05-27T09:27:20+00:00"
},
{
"name": "symfony/polyfill-intl-normalizer",
"version": "v1.23.0",
......
......@@ -3,7 +3,17 @@
namespace App\Controller\Admin;
use App\Entity\Post;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Config\Filters;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TimeField;
use EasyCorp\Bundle\EasyAdminBundle\Filter\ChoiceFilter;
class PostCrudController extends AbstractCrudController
{
......@@ -12,14 +22,36 @@ class PostCrudController extends AbstractCrudController
return Post::class;
}
/*
public function configureFields(string $pageName): iterable
{
return [
IdField::new('id'),
IdField::new('id')->onlyOnIndex(),
TextField::new('title'),
TextEditorField::new('description'),
ImageField::new('postImage')
->setBasePath('uploads/images')
->setUploadDir('public/uploads/images')
->setUploadedFileNamePattern('[slug]-[contenthash].[extension]'),
TextareaField::new('summary'),
TextEditorField::new('body'),
ChoiceField::new('status')
->setChoices(fn() => ['draft' => 'draft', 'published' => 'published']),
TimeField::new('createdAt')
->setFormat('Y-MM-dd HH:mm:ss')->onlyOnIndex(),
TimeField::new('updatedAt')
->setFormat('Y-MM-dd HH:mm:ss')->onlyOnIndex(),
];
}
*/
public function configureCrud(Crud $crud): Crud
{
return $crud->setDefaultSort(['id' => 'DESC'])
->setSearchFields(['title', 'summary', 'body']);
}
public function configureFilters(Filters $filters): Filters
{
return $filters->add(ChoiceFilter::new('status')
->setChoices(['draft' => 'draft', 'published' => 'published']));
}
}
......@@ -358,6 +358,9 @@
"ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f"
}
},
"symfony/mime": {
"version": "v5.3.2"
},
"symfony/monolog-bridge": {
"version": "v5.3.0"
},
......@@ -406,6 +409,9 @@
"symfony/polyfill-intl-icu": {
"version": "v1.23.0"
},
"symfony/polyfill-intl-idn": {
"version": "v1.23.0"
},
"symfony/polyfill-intl-normalizer": {
"version": "v1.23.0"
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册