Open mabehiry opened 6 years ago
Fixed by removing: use SoftDeletes; in app\Role.php
I've the same error in many pages, such as this: ErrorException in Builder.php line 1185: count(): Parameter must be an array or an object that implements Countable (View: D:\wamp64\www\la1\resources\views\la\modules\show.blade.php) What's the problem?
Hi @mabehiry , what is your laravel version ?
version 7.2. Same problemo!
I use laravel 5.2 and I have the same problem
The same Laragon Doing like in the instuction http://laraadmin.com/docs/1.0/installation
Hello, I also have the exact same problem. I did the first installation. When he goes to insert the link in the browser and I send, I also receive the exact same error
Thanks for all
I have same problem. Laravel 5.2, php 7.2 If change error Line 1185 in 'vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php' to: $originalWhereCount = is_array($query->wheres) ? count($query->wheres) : 0;
error will be fix, but I am new in Laravel.
I follow the docs at: http://laraadmin.com/docs/1.0
but same error for me: Laravel 5.2.31, Laraadmin 1.0.40 PHP 7.2.2 (provide in homestead vagrant v7.1.2).
What suggest efimov82 solves the issue.
Solved this downgrading my php to 7.1.12 in mamp
Fixed by removing: use SoftDeletes; in app\Role.php
Solved my problem!!
remove use SoftDeletes ;
in app\Role.php
After logging in, the same error came up so I deleted the same line"use SoftDeletes;" but from app -> permission.php no error can't say if I damaged something
Fixed by removing: use SoftDeletes; in app\Role.php
Thanks.
This error is caused by the PHP version.
Modify line 1185 of the 'vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php' file
$originalWhereCount = count ($ query-> wheres);
to
$originalWhereCount = 0; if (is_array ($ query-> wheres) || is_object ($ query-> wheres)) { $originalWhereCount = count ($ query-> wheres); }
You shouldn't modify Laravel core, that's extremely dangerous!
The root cause for this problem is the PHP version, maximum suported is 7.1.X and Laravel 5.3. You have to double check on these lines that you have the correct version supported in the generated code and in the base templates: https://github.com/dwijitsolutions/laraadmin/commit/b8557a2df91ad0f8ac24da2a0d644d6cc21cad79
The problem is about the PHP version, This is the documentation's Larevel 7.X : https://laravel.com/docs/7.x and this is the link of the Laravel 5.3 : https://laravel.com/docs/5.3
If you comment out use SoftDeletes; which is @ line 14 of app\Role.php then the problem will be solved only for the front page I mean only for the Landing page. But if you log in and try to access other pages it still continues. but if you fix the line $originalWhereCount = count($query->wheres); is @1185 of 'vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php'. The error will not get a repeat. Just replace it with $originalWhereCount = is_array($query->wheres) ? count($query->wheres) : 0;
The problem is about the PHP version, I have downgraded my PHP version to 7.1.33 & it's working fine now.
You shouldn't modify Laravel core, that's extremely dangerous!
Fixed by removing: use SoftDeletes; in app\Role.php
Problem Solved!
Yeah, but you leave without having soft deletes in Roles @clitorio , exchanged one problem for another.
If you comment out use SoftDeletes; which is @ line 14 of app\Role.php then the problem will be solved only for the front page I mean only for the Landing page. But if you log in and try to access other pages it still continues. but if you fix the line $originalWhereCount = count($query->wheres); is @1185 of 'vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php'. The error will not get a repeat. Just replace it with $originalWhereCount = is_array($query->wheres) ? count($query->wheres) : 0;
do not comment out the section - use SoftDeletes; in app\Role.php This will break the functionality.
Se corrigió eliminando: use SoftDeletes; en la aplicación \ Role.php
Horas buscando el error y acá me ayudaste. Muchas gracias.
Hi, this is a nice package but I think that the developers have stopped working on it. Maybe you can try this package: https://github.com/Muhammadinaam/speed-admin. It supports Laravel 8+.
You shouldn't modify Laravel core, that's extremely dangerous!
The root cause for this problem is the PHP version, maximum suported is 7.1.X and Laravel 5.3. You have to double check on these lines that you have the correct version supported in the generated code and in the base templates: b8557a2
it's solve my problem thankssss
Hello, After I installed the package, I get this error when going to: http://localhost/la1/public/ ErrorException in Builder.php line 1185: count(): Parameter must be an array or an object that implements Countable in Builder.php line 1185 at HandleExceptions->handleError('2', 'count(): Parameter must be an array or an object that implements Countable', 'D:\wamp64\www\sales\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php', '1185', array('scope' => object(Closure), 'parameters' => array(object(Builder)), 'query' => object(Builder))) at count(null) in Builder.php line 1185 at Builder->callScope(object(Closure)) in Builder.php line 1216 at Builder->applyScopes() in Builder.php line 1316 at Builder->toBase() in Builder.php line 1423 at Builder->call('count', array()) at call_user_func_array(array(object(Builder), 'count'), array()) in Model.php line 3526 at Model->__call('count', array()) at call_user_func_array(array(object(Role), 'count'), array()) in Model.php line 3540 at Model::callStatic('count', array()) in AuthController.php line 66 at AuthController->showLoginForm() at call_user_func_array(array(object(AuthController), 'showLoginForm'), array()) in Controller.php line 80 at Controller->callAction('showLoginForm', array()) in ControllerDispatcher.php line 146 at ControllerDispatcher->call(object(AuthController), object(Route), 'showLoginForm') in ControllerDispatcher.php line 94 at ControllerDispatcher->Illuminate\Routing{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52 at Pipeline->Illuminate\Routing{closure}(object(Request)) in RedirectIfAuthenticated.php line 24 at RedirectIfAuthenticated->handle(object(Request), object(Closure)) at call_user_func_array(array(object(RedirectIfAuthenticated), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 at Pipeline->Illuminate\Routing{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102 at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 96 at ControllerDispatcher->callWithinStack(object(AuthController), object(Route), object(Request), 'showLoginForm') in ControllerDispatcher.php line 54 at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\Auth\AuthController', 'showLoginForm') in Route.php line 174 at Route->runController(object(Request)) in Route.php line 140 at Route->run(object(Request)) in Router.php line 724 at Router->Illuminate\Routing{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52 at Pipeline->Illuminate\Routing{closure}(object(Request)) in VerifyCsrfToken.php line 64 at VerifyCsrfToken->handle(object(Request), object(Closure)) at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 at Pipeline->Illuminate\Routing{closure}(object(Request)) in ShareErrorsFromSession.php line 49 at ShareErrorsFromSession->handle(object(Request), object(Closure)) at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 at Pipeline->Illuminate\Routing{closure}(object(Request)) in StartSession.php line 64 at StartSession->handle(object(Request), object(Closure)) at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 at Pipeline->Illuminate\Routing{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37 at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 at Pipeline->Illuminate\Routing{closure}(object(Request)) in EncryptCookies.php line 59 at EncryptCookies->handle(object(Request), object(Closure)) at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 at Pipeline->Illuminate\Routing{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102 at Pipeline->then(object(Closure)) in Router.php line 726 at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 699 at Router->dispatchToRoute(object(Request)) in Router.php line 675 at Router->dispatch(object(Request)) in Kernel.php line 246 at Kernel->Illuminate\Foundation\Http{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52 at Pipeline->Illuminate\Routing{closure}(object(Request)) in CheckForMaintenanceMode.php line 44 at CheckForMaintenanceMode->handle(object(Request), object(Closure)) at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 at Pipeline->Illuminate\Routing{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102 at Pipeline->then(object(Closure)) in Kernel.php line 132 at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99 at Kernel->handle(object(Request)) in index.php line 53