本文整理汇总了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);
}