|
7 | 7 | use Illuminate\Support\Facades\Blade;
|
8 | 8 | use Barryvdh\Form\Extension\SessionExtension;
|
9 | 9 | use Illuminate\View\View;
|
| 10 | +use Symfony\Component\Form\Extension\Core\CoreExtension; |
10 | 11 | use Symfony\Component\Form\Form;
|
11 | 12 | use Symfony\Component\Form\FormFactory;
|
| 13 | +use Symfony\Component\Form\FormFactoryBuilder; |
12 | 14 | use Symfony\Component\Form\FormFactoryInterface;
|
13 | 15 | use Symfony\Component\Form\FormRendererInterface;
|
14 | 16 | use Symfony\Component\Form\Forms;
|
|
19 | 21 | use Symfony\Component\Form\ResolvedFormTypeFactory;
|
20 | 22 | use Illuminate\Support\ServiceProvider as BaseServiceProvider;
|
21 | 23 | use Symfony\Bridge\Twig\Extension\FormExtension;
|
| 24 | +use Symfony\Component\PropertyAccess\PropertyAccess; |
22 | 25 |
|
23 | 26 | class ServiceProvider extends BaseServiceProvider
|
24 | 27 | {
|
@@ -62,7 +65,7 @@ public function boot()
|
62 | 65 | }
|
63 | 66 | return app('translator')->get($id, $replace, $locale);
|
64 | 67 | }));
|
65 |
| - |
| 68 | + |
66 | 69 | // csrf_token needs to be replaced for Laravel
|
67 | 70 | $twig->addFunction(new \Twig\TwigFunction('csrf_token', 'csrf_token'));
|
68 | 71 |
|
@@ -117,7 +120,14 @@ public function register()
|
117 | 120 | });
|
118 | 121 |
|
119 | 122 | $this->app->singleton(FormFactory::class, function ($app) {
|
| 123 | + |
| 124 | + // Disable Invalid Property access because or how Eloquent works |
| 125 | + $propertyAccess = PropertyAccess::createPropertyAccessorBuilder() |
| 126 | + ->disableExceptionOnInvalidPropertyPath() |
| 127 | + ->getPropertyAccessor(); |
| 128 | + |
120 | 129 | return Forms::createFormFactoryBuilder()
|
| 130 | + ->addExtension(new CoreExtension($propertyAccess)) |
121 | 131 | ->addExtensions($app['form.extensions'])
|
122 | 132 | ->addTypeExtensions($app['form.type.extensions'])
|
123 | 133 | ->addTypeGuessers($app['form.type.guessers'])
|
|
0 commit comments