带有consoletvs v6的Laravel制作动态图表

时间:2019-08-14 23:42:01

标签: php laravel charts

我想为ID为的所选调查制作一个动态图表,答案在图表中显示,并计算该选项的选择数量。

我尝试使用chart = Sondage :: database(...),但是我得到了对未定义方法App \ Charts \ sondage :: database()的调用

答案模型:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
class Answer extends Model
{
    protected $fillable = ['answer','commentaire','user_id','survey_id','last_ip'];
    protected $table = 'answer';

    public function survey() {
      return $this->belongsTo('App\Survey', 'survey_id');
    }

    public function question() {
      return $this->belongsTo(Question::class);
    }
    public function user() {
      return $this->belongsTo('App\User', 'user_id');
 }
}

控制器:

 $chart = sondage::database(Answer::where('survey_id','=',$survey->id),'line','highcharts')
                    ->title('Tokens')
                    ->ElementLabel('Coins Sold')
                    ->Responsive(true)
                    ->dimensions(1000,500)
                    ->data(Graph::find(1));

您能帮我找到一种方法吗?

0 个答案:

没有答案