【发布时间】:2019-11-05 19:41:45
【问题描述】:
为什么我不能从我的数据库中填充数据集?我可以渲染图表,但没有显示数据。但是当我在 laravel 中使用“dd”命令时,它会显示数据数组。帮助将不胜感激。谢谢。
这是我现在的输出https://imgur.com/a/eyCVxSn
这是我的控制器
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\User;
use Illuminate\Support\Facades\DB;
use Charts;
use App\Graph;
class GraphController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$chart = Charts::database(Graph::get()->find(1),'line','highcharts')
->title('Tokens')
->ElementLabel('Coins Sold')
->Responsive(true)
->data(Graph::all())
;
//dd($chart);
return view('coin.news', ['chart' => $chart]);
}
}
我的 Graph.php 模型
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Auth;
use Cache;
use Charts;
class Graph extends Model
{
//
protected $connection = 'mysql2';
protected $table = 'ico_stages';
}
我的graph.blade.php
@section('graph')
{!! $chart->render() !!}
@endsection
我的 app.blade.php
Header files...
{!! Charts::assets() !!}
Content....
Graph Section...
Footers....
web.php
//Landing Page
Route::get('/coin', 'GraphController@index');
【问题讨论】:
-
回答任何人?请帮忙..非常需要它
标签: javascript php laravel charts package