本文整理匯總了PHP中Teacher::whereRaw方法的典型用法代碼示例。如果您正苦於以下問題:PHP Teacher::whereRaw方法的具體用法?PHP Teacher::whereRaw怎麽用?PHP Teacher::whereRaw使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Teacher
的用法示例。
在下文中一共展示了Teacher::whereRaw方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getTeachersData
public function getTeachersData($classid)
{
$colid = Session::get('user')->collegeid;
// $colid = "bt123";
$teachers = Teacher::whereRaw('collegeid = ? and classid = ?', array($colid, $classid))->get();
$data['data'] = [];
$i = 0;
for ($i = 0; $i < sizeof($teachers); $i++) {
$data['data'][$i]['pic'] = "<img class= \"img-circle width-1 height-1\" src=\"." . $teachers[$i]->profilepic . ".\">";
$data['data'][$i]['name'] = $teachers[$i]->name;
$data['data'][$i]['email'] = $teachers[$i]->email;
$data['data'][$i]['phone'] = $teachers[$i]->phone;
$flag = Auth::user()->flag;
if ($flag == 3) {
$data['data'][$i]['action'] = "<button type=\"button\" class=\"btn btn-xs btn-icon-toggle\" style=\"float: right; margin-bottom: -0.6em; margin-top: -0.5em;\" data-toggle=\"tooltip\" data-placement=\"top\" data-original-title=\"Copy row\"><i class=\"fa fa-copy\"></i></button>";
} else {
$data['data'][$i]['action'] = "<button type=\"button\" class=\"btn btn-xs btn-icon-toggle\" style=\"float: right; margin-bottom: -0.6em; margin-top: -0.5em; \" data-toggle=\"tooltip\" data-placement=\"top\" data-original-title=\"Delete row\"><i class=\"fa fa-trash-o\"></i></button>\n\n <button type=\"button\" class=\"btn btn-xs btn-icon-toggle\" style=\"float: right; margin-bottom: -0.6em; margin-top: -0.5em;\" data-toggle=\"tooltip\" data-placement=\"top\" data-original-title=\"Copy row\"><i class=\"fa fa-copy\"></i></button>\n\n <button type=\"button\" class=\"btn btn-xs btn-icon-toggle\" style=\"float: right; margin-bottom: -0.6em; margin-top: -0.5em;\" data-toggle=\"tooltip\" data-placement=\"top\" data-original-title=\"Edit row\"><i class=\"fa fa-pencil\"></i></button>";
}
}
return $data;
// return json_encode($data);
}