Crud: Call to a member function count() on array after update from 3.1.54 to 3.2.3

Created on 14 Feb 2017  路  9Comments  路  Source: Laravel-Backpack/CRUD

I have just update my crud package from 3.1.54 to 3.2.3, before update everything works perfectly but now i am getting "Call to a member function count() on array" error in admin listing.

when i check on the framework file the issue in create in below code:

    <?php if($crud->filters->count()): ?>
      <?php echo $__env->make('crud::inc.filters_navbar', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
    <?php endif; ?>

any help how to resolve this

Most helpful comment

For me, I had a list.blade.php in resources\views\vendor\backpack\crud, despite not having changed this manually, so I removed this and re-ran:

php artisan vendor:publish --provider="Backpack\CRUD\CrudServiceProvider" --tag="views"

to recreate it, and all was well.

All 9 comments

Had teh exact same problem, and still don't know how I fixed it. Try php artisan clear to clean compiled templates, or delete your vendor folder and composer update again, something along those lines fixed it for me

Hi guys,

No matter how much I tried, I wasn't able to get the same error updating. If you guys figure out what command helps to clear everything, please let me know - I'd love to put it in the upgrade guide for others. Ideas:
php artisan cache:clear
php artisan dump-autoload
php artisan clear-compiled

Thanks, cheers!

you may try to change from <?php if($crud->filters->count()): ?> to
<?php if(count($crud->filters)): ?>

i also got the error today and when i dd the $crud->filters i got a '[]' as output...

Yes this happened to me too. Ended migrate to Laravel 5.4 ... haha

the same thing.
@AurelDragut fix helped me.

Hello guys,

Check if you have the following file:

/resources/views/vendor/backpack/crud/list.blade.php

If you have it, you must migrate the changes manually.

Otherwise try running:

php artisan view:clear

and also, I got this

ErrorException in LogController.php line 8: Declaration of Backpack\LogManager\app\Http\Controllers\LogController::index() should be compatible with App\Http\Controllers\Controller::index(Illuminate\Http\Request $request)

after update.

Hey,
I got this issue and also issue related to getUri()...

then re-run:

php artisan vendor:publish --provider="Backpack\CRUD\CrudServiceProvider" --tag="views"
php artisan vendor:publish --provider="Backpack\Base\BaseServiceProvider" --tag="views"

hope it will help!

For me, I had a list.blade.php in resources\views\vendor\backpack\crud, despite not having changed this manually, so I removed this and re-ran:

php artisan vendor:publish --provider="Backpack\CRUD\CrudServiceProvider" --tag="views"

to recreate it, and all was well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mikael1000 picture mikael1000  路  3Comments

deepaksp picture deepaksp  路  3Comments

voidstate picture voidstate  路  3Comments

packytagliaferro picture packytagliaferro  路  3Comments

sonoftheweb picture sonoftheweb  路  3Comments