PHP artisan serve does not work
when I tape the command php artisan serve I have this error and I don't know why I'm having this problem I'm using PHP 5.6 and laravel 5.4
[ErrorException]
count(): Parameter must be an array or an object that implements Countable
@AMENKHLIFI may be somewhere you have used count() function on single data: for example
$getData = User::find($id);
if(count($getData)>0) {
}
It will give the error. because it is not an array. count function is only used will array. you can use it with get() or all() method.
This is the function
public static function recaptcha_data(){
$recaptcha_data = array();
$_this = new self;
$settings_data = $_this->settingsData;
if(count($settings_data) > 0){
$recaptcha_data = $settings_data['general_settings']['recaptcha_options'];
}
return $recaptcha_data;
}
@amenkhlifi what are you getting in $settings_data object. can you show me the log of that. Is it in array?
@amenkhlifi
Try as like below.
public static function recaptcha_data(){
$recaptcha_data = array();
$_this = new self;
$settings_data = $_this->settingsData;
if(count($settings_data) > 0){
$recaptcha_data = $settings_data['general_settings']['recaptcha_options'];
}else{
return $recaptcha_data;
}
}
Please or to participate in this conversation.