Laravel-Backpack / CRUD

Build custom admin panels. Fast!
https://backpackforlaravel.com
MIT License
3.16k stars 893 forks source link

Undefined index: columns (View: .... vendor/backpack/crud/src/resources/views/crud/fields/table.blade.php) #2170

Closed rabol closed 5 years ago

rabol commented 5 years ago

Bug report

What I did

STEP 1. create migration php artisan make:migration:schema create_tags_table --model=0 --schema="name:string:unique" add a json filed $table->json('tag_features')->nullable() php artisan migrate

STEP 2. create crud php artisan backpack:crud tag

What I expected to happen

being able to add a new record

What happened

Exception was thrown Facade\Ignition\Exceptions\ViewException Undefined index: columns (View: /home/vagrant/code/backpack/vendor/backpack/crud/src/resources/views/crud/fields/table.blade.php)

What I've already tried to fix it

Nothing so far

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

PHP VERSION:

PHP 7.3.9-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Sep 2 2019 12:54:24) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.9, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.9-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

LARAVEL VERSION:

laravel/framework v6.3.0 The Laravel Framework.

BACKPACK VERSION:

backpack/crud 4.0.9 Quickly build an admin interfaces using Laravel 6, CoreUI, Boostrap 4 and jQuery. backpack/generators 2.0.4 Generate files for laravel projects

tabacitu commented 5 years ago

Hi @rabol ,

Looks like a misconfigured table field. Configuring it as explained in the docs linked above should fix it for you.

It's weird though - the "table" field is loaded for you automatically? When using setFromDb() in your controller? Or have you manually added it in your controller?

Cheers!

rabol commented 5 years ago

Hi

I did not add anything the first time, pure 'default' code that was created with the backpack:crud command

I found out that I needed to configure the table field manually, but still I think that it's a 'bug' that one have to make 'special' code for a specific field type.

tabacitu commented 5 years ago

I think you're totally right, thank you @rabol . Just pushed a fix so if nothing is defined a simple "value" column will be used, for both fields and columns. Will most likely not be what people are looking for (they'd still need to properly configure their fields), but at least they won't be met with a nasty error.

Thanks, cheers!

ogiogiovictor commented 2 years ago

Hi I am having problems with the CKeditor. When i remove it from the setupCreateOperation() the forms shows but when i add the ckeditor options the form breaks CRUD::field([
'name' => 'about_the_game', 'label' => 'About The Game', 'type' => 'ckeditor', ]);

see error image

tabacitu commented 2 years ago

@ogiogiovictor can't really tell from the screenshot, the error is a bit obscure. Can you please click the Share button there, and copy-paste the error link here? That will give us access to the full error stack, to better understand what's going on.

ogiogiovictor commented 2 years ago

I noticed that the each time i add addFields either ckeditor, tinymce or summertone to setupCreateOperation() I get Class 'Composer\InstalledVersions' not found (View: /home/ogiogiovictor/projects/laravel/games/vendor/backpack/crud/src/resources/views/crud/inc/show_fields.blade.php)

$this->crud->addField([ 'name' => 'about_the_game', 'label' => 'About', 'type' => 'tinymce', // optional overwrite of the configuration array 'options' => [ 'selector' => 'textarea.tinymce', 'skin' => 'dick-light', 'plugins' => 'image,link,media,anchor', 'toolbar' => 'undo redo formatselect fontsizeselect bullist numlist link image bold italic underline forecolor', ], ]);

See Error below: [image: image.png]

On Sat, Sep 17, 2022 at 11:07 PM Cristian Tăbăcitu @.***> wrote:

@ogiogiovictor https://github.com/ogiogiovictor can't really tell from the screenshot, the error is a bit obscure. Can you please click the Share button there, and copy-paste the error link here? That will give us access to the full error stack, to better understand what's going on.

— Reply to this email directly, view it on GitHub https://github.com/Laravel-Backpack/CRUD/issues/2170#issuecomment-1250192811, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALE7KFWGMJIAPSTX54ZUQJTV62PRZANCNFSM4JD42CAQ . You are receiving this because you were mentioned.Message ID: @.***>

tabacitu commented 2 years ago

Hmm: 1) Perhaps you're using Composer v1 and should upgrade to Composer v2? 2) Does a composer update backpack/crud --with-dependencies fix it?