I have a model like below:
<?php
namespace Reputation\Repositories;
use Illuminate\Database\Eloquent\Model;
use Log;
class Result extends Model
{
protected $table = 'results';
public static function storeResults($params)
{
//...
}
public static function totalScore()
{
Log::info('This line is printing' ."\r\n");
$RESULT = (new Result())->get();
Log::info('This is not printing' ."\r\n");
return collect([
'item1' => self::getPercentage($RESULT->where('group', 'general')->count()),
'item2' => self::getPercentage($RESULT->where('group', 'internal')->count()),
$RESULT->count()),
]);
}
protected static function getPercentage($c, $t)
{
return round(($c* 100) / $t, 2);
}
}
The same code was working good, but all of a sudden when I debug I came to this place and lost whats going wrong.. :|
Can anyone help me to debug further or a fix for this..
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire