Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rabol opened this issue Oct 23, 2019 · 7 comments
Labels

Comments

@rabol
Copy link

rabol commented Oct 23, 2019

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
Copy link
Member

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
Copy link
Author

rabol commented Oct 23, 2019

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
Copy link
Member

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
Copy link

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
Copy link
Member

@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
Copy link

ogiogiovictor commented Sep 18, 2022 via email

@tabacitu
Copy link
Member

tabacitu commented Sep 18, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants