2 回答

TA貢獻(xiàn)1783條經(jīng)驗(yàn) 獲得超4個(gè)贊
你必須控制數(shù)據(jù)庫(kù)結(jié)果,如果它在日期選擇上也可以為 laravel 使用 distinct() 和 get 必須在它之前的最后
//This
$date = db::table('students')->select('date')->get()->unique();
//To This
$date = db::table('students')->select('date')->distinct()->get();
if(!$date)
return $this->response;
//or
return false;
//更新
$course = DB::table('students')
->select('id','courseName', 'courses')
->groupBy('courses')//What ever you want to uniqe
->get();
對(duì)于返回視圖示例,您必須自己更改
return $this->responseWithView("index //PAGE","success", ['courses' => $course,'anything' => $youwant]);
- 2 回答
- 0 關(guān)注
- 159 瀏覽
添加回答
舉報(bào)