本文整理汇总了PHP中Courses::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Courses::find方法的具体用法?PHP Courses::find怎么用?PHP Courses::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Courses
的用法示例。
在下文中一共展示了Courses::find方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIndex
public function getIndex($idCourse, $idInscription)
{
$course = Courses::find($idCourse);
$inscription = Inscriptions::find($idInscription);
$files = $inscription->files;
$array = array('course' => $course, 'inscription' => $inscription, 'files' => $files, 'route' => self::parseRoute($course->id, $idInscription), 'parent' => self::parseParent($course->id), 'ancestor' => self::$ancestor, 'msg_success' => Session::get('msg_success'), 'msg_error' => Session::get('msg_error'));
return View::make('backend.inscriptions.files')->with($array);
}
示例2: courseDelete
public function courseDelete()
{
$course_id = Input::get('deleteId');
Homework::where('course_id', '=', $course_id)->delete();
Courseware::where('course_id', '=', $course_id)->delete();
Courses::find($course_id)->delete();
return Redirect::to('course-edit');
}
示例3: getCreate
public function getCreate($idCourse)
{
$course = Courses::find($idCourse);
if ($course) {
return View::make('backend.usertypes.create', array('course' => $course, 'route' => self::parseRoute($idCourse)));
} else {
return Redirect::to($this->parent)->with(array('msg_error' => Lang::get('messages.course_not_found')));
}
}
示例4: getCreate
public function getCreate($idCourse, $idUserType, $idDate = '')
{
$course = Courses::find($idCourse);
if ($course) {
$usertype = UserTypes::find($idUserType);
if ($usertype) {
return View::make('backend.dates.create', array('course' => $course, 'usertype' => $usertype, 'route' => self::parseRoute($idCourse, $idUserType)));
} else {
return Redirect::to(self::parseRoute($idCourse, $idUserType))->with(array('msg_error' => Lang::get('messages.usertype_not_found')));
}
} else {
return Redirect::to($this->ancestor)->with(array('msg_error' => Lang::get('messages.course_not_found')));
}
}
示例5: saveItem
public function saveItem()
{
$cat_id = Input::get('cat_id');
$item_id = Input::get('id');
//获取表单
if ($cat_id == 0) {
//新闻编辑
$title = Input::get('title');
$content = Input::get('content');
$abstract = Input::get('abstract');
$item = News::find($item_id);
} else {
if ($cat_id == 1) {
//项目编辑
$title = Input::get('title');
$content = Input::get('content');
$abstract = Input::get('abstract');
$begin_time = Input::get('begin_time');
$end_time = Input::get('end_time');
$item = Researches::find($item_id);
} else {
if ($cat_id == 2) {
//通知编辑
//
$title = Input::get('title');
$content = Input::get('content');
$item = Notices::find($item_id);
} else {
if ($cat_id == 3) {
//课程编辑
$course_name = Input::get('course_name');
$course_info = Input::get('course_info');
$teacher_address = Input::get('teacher_address');
$teacher_mail = Input::get('teacher_mail');
$TA_name = Input::get('TA_name');
$TA_address = Input::get('TA_address');
$TA_mail = Input::get('TA_mail');
$item = Courses::find($item_id);
$homeworks = Courses::find($item_id)->homework;
$coursewares = Courses::find($item_id)->courseware;
$course_notices = Courses::find($item_id)->comments;
foreach ($course_notices as $notice) {
$update_notice = Comments::find($notice->id);
$update_notice->comment = Input::get('course_notice_content' . $notice->id);
$update_notice->updated_at = date("Y-m-d H:i:s");
$update_notice->save();
}
foreach ($homeworks as $homework) {
//对已有项进行编辑
$delete_or_not = Input::get('homework_delete' . $homework->id);
if ($delete_or_not) {
//如果标记为删除则将已有作业进行删除
$delete_item = Homework::find($homework->id);
$delete_item->delete();
} else {
$update_item = Homework::find($homework->id);
$update_item->homework_item = Input::get('homework_label' . $homework->id);
$update_item->submit_deadline = Input::get('homework_submit_time' . $homework->id);
$update_item->deliver_deadline = Input::get('homework_deliver_time' . $homework->id);
$update_item->updated_at = date("Y-m-d H:i:s");
$update_item->save();
}
}
foreach ($coursewares as $courseware) {
$update_item = Courseware::find($courseware->id);
$update_item->label = Input::get('courseware_label' . $courseware->id);
$update_file_source = 'courseware_ppt' . $courseware->id;
$new_source = HomeController::upload_course($item_id, $update_file_source);
if ($new_source != "") {
//跟新源的同时将旧的课件删除
HomeController::delete_file($update_item->source);
$update_item->source = $new_source;
} else {
}
$update_item->updated_at = date("Y-m-d H:i:s");
$update_item->save();
}
}
}
}
}
//保存数据
if ($item) {
//表中已经存在该条目
if ($cat_id == 0) {
//新闻编辑
$item->title = $title;
$item->content = $content;
$item->abstract = $abstract;
$item->save();
return Redirect::to(URL::to('/news-detail', [$item_id]));
} else {
if ($cat_id == 1) {
//项目编辑
$item->title = $title;
$item->content = $content;
$item->abstract = $abstract;
$item->begin_time = $begin_time;
$item->end_time = $end_time;
$item->save();
//.........这里部分代码省略.........
示例6: postTrabalhocadastro
public function postTrabalhocadastro()
{
$course = Courses::find(Input::get('course'));
$usertype = UserTypes::find(Input::get('usertype'));
$estado = ORGStates::where('id_estado', '=', Input::get('estado'))->take(1)->get();
$estado_empresa = ORGStates::where('id_estado', '=', Input::get('estado_empresa'))->take(1)->get();
//dd(Input::all());
$participant = new ORGParticipants();
$participant->nome = Input::get('nome') != null ? Input::get('nome') : '';
$participant->rg = Input::get('rg') != null ? Input::get('rg') : '';
$participant->cpf = Input::get('cpf') != null ? Input::get('cpf') : '';
$participant->endereco = Input::get('endereco') != null ? Input::get('endereco') : '';
$participant->numero = Input::get('numero') != null ? Input::get('numero') : '';
$participant->complemento = Input::get('complemento') != null ? Input::get('complemento') : '';
$participant->cep = Input::get('cep') != null ? Input::get('cep') : '';
$participant->cidade = Input::get('cidade') != null ? Input::get('cidade') : '';
$participant->estado = isset($estado[0]->name_estado) ? $estado[0]->name_estado : '';
/*$participant->empresa = Input::get('empresa') != null ? Input::get('empresa') : '';
$participant->cnpj = Input::get('cnpj_empresa') != null ? Input::get('cnpj_empresa') : '';
$participant->endereco_empresa = Input::get('endereco_empresa') != null ? Input::get('endereco_empresa') : '';
$participant->numero_empresa = Input::get('nome') != null ? Input::get('nome') : '';
$participant->complemento_empresa = Input::get('complemento_empresa') != null ? Input::get('complemento_empresa') : '';
$participant->cep_empresa = Input::get('cep_empresa') != null ? Input::get('cep_empresa') : '';
$participant->cidade_empresa = Input::get('cidade_empresa') != null ? Input::get('cidade_empresa') : '';
$participant->estado_empresa = isset($estado_empresa[0]->name_estado) ? $estado_empresa[0]->name_estado : '';
$participant->celular = Input::get('celular_empresa') != null ? Input::get('celular_empresa') : '';*/
$participant->telefone = Input::get('telefone_empresa') != null ? Input::get('telefone_empresa') : '';
$participant->email = Input::get('email') != null ? Input::get('email') : '';
$participant->save();
$user = new User();
$user->email = $participant->email;
if ($participant->nome != null) {
$user->name = $participant->nome;
} else {
$user->name = "User without name";
}
$user->status = 'publish';
$user->type = 'participant';
$user->save();
$participant = ORGParticipants::getByCPF($participant->cpf);
$part = new Participants();
$part->participant = $participant[0]->id_participante;
$part->user = $user->id;
$part->email = $participant[0]->email;
$part->name = $participant[0]->nome;
$part->cpf = $participant[0]->cpf;
$part->status = 'publish';
$part->type = 'participant';
$part->save();
Auth::user()->login($user);
if ($inscription = Inscriptions::hasInscription(Auth::user()->user()->id, $course->id)) {
$array = array('msg_success' => Lang::get('messages.login_welcome'), 'usertype' => $usertype, 'inscription' => $inscription);
return Redirect::to($course->route . '/arquivos')->with($array);
} else {
$inscription = new Inscriptions();
$inscription->id_course = $course->id;
$inscription->id_user = Auth::user()->user()->id;
$inscription->id_usertype = $usertype->id;
$inscription->save();
$array = array('usertype' => $usertype, 'inscription' => $inscription);
return Redirect::to($course->route . '/arquivos')->with($array);
}
}
示例7: getDelete
public function getDelete($id = '')
{
if ($id == '') {
return Redirect::to($this->route)->with('msg_error', Lang::get('messages.courses_display_err'));
} else {
$course = Courses::find($id);
$delete = Courses::destroy($id);
if (!$delete) {
return Redirect::to($this->route . '/trash')->with('msg_error', Lang::get('messages.courses_delete_err', array('title' => $course->title)));
} else {
return Redirect::to($this->route . '/trash')->with('msg_success', Lang::get('messages.courses_delete', array('title' => $course->title)));
}
}
}
示例8: getExportinscriptions
public function getExportinscriptions($idCourse)
{
$course = Courses::find($idCourse);
$inscriptions = $course->inscriptions;
$users = array();
$trainings = ORGTrainings::all();
$states = ORGStates::all();
$towns = ORGTowns::all();
$h = 0;
foreach ($inscriptions as $ins) {
# code...
// var_dump($ins->id);
if ($ins->user->type == "associate" || $ins->user->id == 127) {
// var_dump($ins->user->id);
// var_dump($ins->user->type);
$tempuser = Associates::where('user', '=', $ins->user->id)->take(1)->get();
$users[$ins->id] = $tempuser[0]->asociado;
} elseif ($ins->user->type == "participant" && $ins->user->id != 127) {
$tempuser = Participants::where('user', '=', $ins->user->id)->take(1)->get();
// if($h>30)
// dd($ins->user->id);
// else
// var_dump($tempuser[0]->id);
$users[$ins->id] = $tempuser[0]->participante;
// }
/*if(isset($tempuser[0])):
$users[$ins->id]=$tempuser[0]->participante;
else:
var_dump($ins->user->type);
dd($ins->user->id);
endif;*/
}
$h++;
}
// foreach($inscriptions as $inscription):
// // $total["name"] = $inscription->user->name;
// // $total["email"] = $inscription->user->email;
// // $total["paid"] = $inscription->paid;
// // $total["date"] = date_format(date_create($inscription->created_at), 'd-m-Y');
// // $total["type"] = $inscription->usertype->title;
// $total= ["nome" => $inscription->user->name,
// "email" => $inscription->user->email,
// "paid" => $inscription->paid,
// "date" => date_format(date_create($inscription->created_at), 'd-m-Y'),
// "type" => $inscription->usertype->title
// ];
// // break;
// // array_push($total,$inscription->user->name,$inscription->user->email);
// endforeach;
// dd($inscriptions);
Excel::create('Export Inscriptions ' . $course->title . "-" . rand(2, 700 * date("H")) . "-" . date("d-m-Y"), function ($excel) use($inscriptions, $users) {
$excel->sheet('Excel sheet', function ($sheet) use($inscriptions, $users) {
$sheet->setOrientation('portrait');
$n = 2;
// $sheet->appendRow(1,array("Codigo Asociado","Nome","RG","Email", "Telefone", "Celular", "CPF", "Tipo Pessoa","Pagamento", "Fecha", "User Type", "Endereço", "Complemento", "CEP", "Cidade", "Estado", "Empresa", "Endereço Empresa", "Complemento Empresa", "Telefone Empresa", "CNPJ", "Cargo" ));
// $inscriptions = $inscriptions;
foreach ($inscriptions as $inscription) {
// $total["name"] = $inscription->user->name;
// $total["email"] = $inscription->user->email;
// $total["paid"] = $inscription->paid;
// $total["date"] = date_format(date_create($inscription->created_at), 'd-m-Y');
// $total["type"] = $inscription->usertype->title;
if ($inscription->paid == 0) {
$paid = "Não";
} else {
$paid = "Sim";
}
if ($inscription->user->type == 'associate' || $inscription->user->id == 127) {
// if(isset($users[$inscription->id]->codigo_asoc)){
// var_dump($users[$inscription->id]->nombre_completo);
// }else{
// dd($inscription->user->id);
// }
$cod_aso = $users[$inscription->id]->codigo_asoc;
$nome = $users[$inscription->id]->nombre_completo;
$rg = "";
//No agregados
$incripcion_estadual = $users[$inscription->id]->inscripcion_estadual;
$incripcion_municipal = $users[$inscription->id]->inscripcion_municipal;
$data_nascimento = $users[$inscription->id]->data_nascimento;
$training = ORGTrainings::find($users[$inscription->id]->formacao);
if ($training) {
$training = $training->nome;
} else {
$training = "";
}
$categoria_titulo = ORGAssociateCategories::all();
foreach ($categoria_titulo as $cat) {
if ($users[$inscription->id]->categoria == $cat->id_categoria_asociado) {
$categoria_titulo = $cat->nombre_categoria;
break;
}
}
$logradouro_res = "";
$backyards = ORGBackyards::all();
foreach ($backyards as $backyard) {
if ($users[$inscription->id]->logradouro_res == $backyard->id_logradouro) {
$logradouro_res = $backyard->nombre;
break;
}
//.........这里部分代码省略.........
示例9: array
Session::put('school', $id);
return View::make("teacher.courses")
->with("title", "Course")
->with("coursesByschool", $coursesByschool)
->with("countSprints", $countSprints)
->with("school", $id)
->with("studyroom", false)
->with("user", $user);*/
}));
//Route to sprint for Teacher
Route::get("course/teacher_sprints/{course}", array("as" => "teacher/sprintsBycourse", function ($course) {
$user = Auth::user();
//$course = Input::get('course');
$school = Session::get('school');
$sprints = DB::table('sprints')->where('course', $course)->where('deleted_at', NULL)->get();
$courseByID = Courses::find($course);
return View::make("teacher.sprints")->with("title", "Sprint")->with("parent_title", "Course")->with("sprints", $sprints)->with("school", $school)->with("course", $course)->with("courseByID", $courseByID)->with("studyroom", false)->with("user", $user);
}));
Route::get("all_sprints", array("as" => "teacher/sprints", function () {
$user = Auth::user();
$courses = DB::select("SELECT DISTINCT(lms_classcourse.course) FROM lms_classcourse\n\t\t\t\tLEFT JOIN lms_schoolclass ON lms_schoolclass.class = lms_classcourse.class\n\t\t\t\tLEFT JOIN lms_schooluser ON lms_schooluser.school = lms_schoolclass.school\n\t\t\t\tWHERE lms_schooluser.user = " . $user->id);
$course_name = array();
$course_arr = array();
foreach ($courses as $course) {
$coursename = DB::table('courses')->where('id', $course->course)->where('deleted_at', NULL)->select('name')->get();
$course_name[$course->course] = $coursename[0]->name;
array_push($course_arr, $course->course);
}
$classes = DB::select("SELECT DISTINCT(lms_schoolclass.class) FROM lms_schoolclass\n\t\t\t\tLEFT JOIN lms_schooluser ON lms_schooluser.school = lms_schoolclass.school\n\t\t\t\tWHERE lms_schooluser.user = " . $user->id);
$class_name = array();
foreach ($classes as $class) {
示例10: postAuth
public function postAuth()
{
$credentials = array('email' => Input::get('email'), 'password' => Input::get('password'), 'type' => 'associate');
$course = Courses::find(Input::get('course'));
if (Auth::user()->attempt($credentials)) {
if ($payment = ORGAssociateAnnuities::hasAnnuity(Auth::user()->user())) {
return Redirect::to(self::$route . '/acusado');
} else {
return Redirect::to(self::$route . '/pagamento');
}
} else {
$associate = Associates::getByEmail($credentials['email']);
if (!empty($associate[0])) {
$associate = $associate[0];
if ($associate->password == md5($credentials['password'])) {
$user_finded = User::where('email', '=', $credentials['email'])->take(1)->get();
$user = null;
if (!empty($user_finded[0])) {
$user = $user_finded[0];
$user->password = Hash::make($credentials['password']);
$user->save();
} else {
$user = new User();
$user->email = $associate->email;
if ($associate->nombre_completo != null) {
$user->name = $associate->nombre_completo;
} else {
$user->name = "User without name";
}
$user->status = 'publish';
$user->type = 'associate';
$user->password = Hash::make($credentials['password']);
$user->save();
$associate->user = $user->id;
$associate->save();
}
Auth::user()->login($user);
if ($payment = ORGAssociateAnnuities::hasAnnuity(Auth::user()->user())) {
return Redirect::to(self::$route . '/acusado');
} else {
return Redirect::to(self::$route . '/pagamento');
}
} else {
$associate = ORGAssociates::getByEmail($credentials['email']);
if (!empty($associate[0])) {
$associate = $associate[0];
if ($associate->senha == md5($credentials['password'])) {
$user = new User();
$user->email = $associate->email;
if ($associate->nombre_completo != null) {
$user->name = $associate->nombre_completo;
} else {
$user->name = "User without name";
}
$user->status = 'publish';
$user->type = 'associate';
$user->password = Hash::make($credentials['password']);
$user->save();
$assoc = new Associates();
$assoc->associate = $associate->id_asociado;
$assoc->user = $user->id;
$assoc->email = $associate->email;
if ($associate->nombre_completo != null) {
$assoc->name = $associate->nombre_completo;
} else {
$assoc->name = "User without name";
}
$assoc->cpf = $associate->cpf;
$assoc->password = $associate->senha;
$assoc->status = 'publish';
$assoc->type = 'associate';
$assoc->save();
Auth::user()->login($user);
if ($payment = ORGAssociateAnnuities::hasAnnuity(Auth::user()->user())) {
return Redirect::to(self::$route . '/acusado');
} else {
return Redirect::to(self::$route . '/pagamento');
}
} else {
return Redirec::to(self::$route . '/error');
}
} else {
return Redirec::to(self::$route . '/error');
}
return Redirec::to(self::$route . '/error');
}
} else {
$associate = ORGAssociates::getByEmail($credentials['email']);
if (!empty($associate[0])) {
$associate = $associate[0];
if ($associate->senha == md5($credentials['password'])) {
$user = new User();
$user->email = $associate->email;
if ($associate->nombre_completo != null) {
$user->name = $associate->nombre_completo;
} else {
$user->name = "User without name";
}
$user->status = 'publish';
$user->type = 'associate';
//.........这里部分代码省略.........
示例11: postUpdate
public function postUpdate($idCourse, $idContent = '')
{
if ($idContent == '') {
return Redirect::to(self::parseRoute($idCourse));
} else {
$content = CoursesSection::find($idContent);
if (!$content) {
return Redirect::to(self::parseRoute($idCourse));
} else {
$course = Courses::find($idCourse);
if (Input::get('teachers') != null) {
$teachers = Input::get('teachers');
$course->teachers()->sync($teachers);
} elseif (Input::get('promotioners') != null) {
$promotioners = Input::get('promotioners');
$course->promotioners()->sync($promotioners);
} elseif (Input::get('helpers') != null) {
$helpers = Input::get('helpers');
$course->helpers()->sync($helpers);
} elseif (Input::get('supporters') != null) {
$supporters = Input::get('supporters');
$course->supporters()->sync($supporters);
}
$content->content = Input::get('content');
if ($content->save()) {
return Redirect::to(self::parseRoute($idCourse))->with('msg_success', Lang::get('messages.contents_update', array('title' => $content->title)));
} else {
return Redirect::to(self::parseRoute($idCourse))->with('msg_error', Lang::get('messages.contents_update_err', array('title' => $content->title)));
}
}
}
}
示例12: getClassessByFranchiseeCourseId
static function getClassessByFranchiseeCourseId($franchiseeId, $franchiseeCourseId)
{
$courseMasterId = Courses::find($franchiseeCourseId);
$franchiseeClasses = ClassesMaster::getClassesMasterForDropDown($courseMasterId->master_course_id);
return $franchiseeClasses;
}
示例13: teacherDeleteAction
public function teacherDeleteAction()
{
$input = Input::all();
$id = $input["id"];
$user_id = $input["userID"];
$course = Courses::find($id);
if ($course->created_by == $user_id) {
$course = Courses::find($id);
$course->deleted_at = new DateTime(date('Y-m-d H:i:s'));
$course->save();
/*Courses::find($id)->delete();*/
}
DB::table('classcourse')->where('course', $id)->delete();
return Redirect::route('teacher/sprints');
}
开发者ID:AxelPardemann,项目名称:E-Learning-System-based-on-Laravel-and-Bootstrap,代码行数:15,代码来源:CourseController.php