本文整理汇总了PHP中Sections::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Sections::find方法的具体用法?PHP Sections::find怎么用?PHP Sections::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sections
的用法示例。
在下文中一共展示了Sections::find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postDeleteSections
public function postDeleteSections()
{
$section_id = Input::get('section_id');
$section_name = Input::get('section_name');
$class_id = Input::get('class_id');
if ($section_id) {
$sections = Sections::find($section_id);
} else {
$sections = Sections::where('section_name', '=', $section_name)->where('class_id', '=', $class_id);
}
if ($sections->delete()) {
$response = array('status' => 'success', 'msg' => 'Setting created successfully', 'deleted_item_id' => $section_id);
return Response::json($response);
} else {
$response = array('status' => 'failed', 'msg' => 'Item is Not deleted', 'Item_id' => $section_id);
return Response::json($response);
}
}
示例2: getDelete
public function getDelete($id = '')
{
if ($id == '') {
return Redirect::to($this->route)->with('msg_error', Lang::get('messages.sections_display_err'));
} else {
$section = Sections::find($id);
$delete = Sections::destroy($id);
if (!$delete) {
return Redirect::to($this->route . '/trash')->with('msg_error', Lang::get('messages.sections_delete_err', array('title' => $section->title, 'description' => $section->description, 'file' => $section->file)));
} else {
return Redirect::to($this->route . '/trash')->with('msg_success', Lang::get('messages.sections_delete', array('title' => $section->title, 'description' => $section->description, 'file' => $section->file)));
}
}
}
示例3: getSchoolStudents
public function getSchoolStudents()
{
$query = "select\n users.id,\n users.school_id,\n user_details.username,\n user_details.first_name,\n user_details.last_name,\n users_to_class.class_id,\n users_to_class.section_id,\n user_details.pic\n from users\n join users_groups\n on users.id=users_groups.user_id and users_groups.groups_id=? and users.school_id=?\n join user_details\n on users.id=user_details.user_id\n join users_to_class\n on users_to_class.user_id=users.id";
$all_school_users = DB::select($query, array(2, $this->getSchoolId()));
$i = 0;
foreach ($all_school_users as $all_school_user) {
$class = Classes::find($all_school_user->class_id)->get()->first();
$all_users[$i]['class_name'] = $class->class;
$section = Sections::find($all_school_user->section_id);
$all_users[$i]['section_name'] = $section->section_name;
$all_users[$i]['username'] = $all_school_user->username;
$all_users[$i]['first_name'] = $all_school_user->first_name;
$all_users[$i]['last_name'] = $all_school_user->last_name;
$all_users[$i]['pic'] = $all_school_user->pic;
$all_users[$i]['id'] = $all_school_user->id;
$all_users[$i]['school_id'] = $all_school_user->school_id;
$i++;
}
return View::make('admin.school-students')->with('users', $all_users);
}