本文整理汇总了PHP中Illuminate\Support\Facades\DB::Table方法的典型用法代码示例。如果您正苦于以下问题:PHP DB::Table方法的具体用法?PHP DB::Table怎么用?PHP DB::Table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\DB
的用法示例。
在下文中一共展示了DB::Table方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetHistory
public function GetHistory()
{
if (Auth::check()) {
/*
* Pie chart
*/
$p = new \chartphp();
$DB = DB::Table('users')->select('Apple', 'Car', 'House', 'Gas')->where('id', '=', '2')->get();
$fields = [];
foreach ($DB as $ind => $val) {
foreach ($val as $x => $y) {
$fields[] = [$x, $y];
}
}
$data = [$fields];
$p->data = $data;
$p->chart_type = "pie";
$p->title = "";
$out = $p->render('c2');
/*
* end pie chart
*/
/*
* Line Chart
*/
$p = new \chartphp();
$p->data = array(array(array(48.25, "2014-01-11"), array(95.5, "2014-01-12"), array(238.75, "2014-01-13"), array(286.8, "2014-01-14"), array(300.5, "2014-01-15")));
$p->chart_type = "line";
// Common Options
$p->title = "Sales - 2014 vs 2015";
$p->ylabel = "Sales";
// For Custom Legend Names
$p->series_label = array("2014", "2015");
$p->legend_show = false;
// Date interval for y axis
$p->y_data_type = 'date';
$p->y_tick_interval = '2 day';
$Line = $p->render('c1');
/*
end line chart
*/
$id = Auth::user()->id;
$Acc = $History = DB::table('users')->select('BankAcc', 'StockAcc')->where('id', '=', $id)->get();
$Error = ' ';
$History = DB::table('History')->select('Name', 'StockName', 'price', 'Date')->where('UID', '=', $id)->Take(5)->get();
if ($History == null) {
$Error = 'You Have no purchased Stocks';
return view('pages.Home')->with('Error', $Error)->with('History', $History)->with('Acc', $Acc)->with('out', $out);
} else {
return view('pages.home')->with('History', $History)->with('Error', $Error)->with('Acc', $Acc)->with('out', $out)->with('Line', $Line)->with('data', $data);
}
} else {
return redirect()->intended('auth/login');
}
}