added upload
This commit is contained in:
		@@ -4,25 +4,31 @@ namespace App\Controller\Admin;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use App\Entity\Projects;
 | 
					use App\Entity\Projects;
 | 
				
			||||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
 | 
					use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
 | 
				
			||||||
 | 
					use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
 | 
				
			||||||
 | 
					use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField;
 | 
				
			||||||
 | 
					use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
class ProjectsCrudController extends AbstractCrudController
 | 
					class ProjectsCrudController extends AbstractCrudController
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public static function getEntityFqcn(): string
 | 
						public static function getEntityFqcn(): string
 | 
				
			||||||
    {
 | 
						{
 | 
				
			||||||
        return Projects::class;
 | 
							return Projects::class;
 | 
				
			||||||
    }
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
    /*
 | 
						public function configureFields(string $pageName): iterable
 | 
				
			||||||
    public function configureFields(string $pageName): iterable
 | 
						{
 | 
				
			||||||
    {
 | 
							yield IdField::new(propertyName: 'id')
 | 
				
			||||||
        return [
 | 
								->onlyOnIndex();
 | 
				
			||||||
            IdField::new('id'),
 | 
							yield TextField::new(propertyName: 'name');
 | 
				
			||||||
            TextField::new('title'),
 | 
							yield TextField::new(propertyName: 'description');
 | 
				
			||||||
            TextEditorField::new('description'),
 | 
							yield TextField::new(propertyName: 'description');
 | 
				
			||||||
        ];
 | 
							yield ImageField::new(propertyName: 'teaserImage')
 | 
				
			||||||
    }
 | 
								->setBasePath(path: 'uploads/projects')
 | 
				
			||||||
    */
 | 
								->setUploadDir(uploadDirPath: 'public/uploads/projects')
 | 
				
			||||||
 | 
								->setUploadedFileNamePattern(patternOrCallable: '[timestamp]-[slug].[extension]');
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user