本文整理汇总了PHP中Teacher::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Teacher::create方法的具体用法?PHP Teacher::create怎么用?PHP Teacher::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Teacher
的用法示例。
在下文中一共展示了Teacher::create方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
DB::table('teachers')->delete();
$extra = array('1', '2', '3', '4');
$extra = serialize($extra);
Teacher::create(array('user_id' => 1, 'email' => 'johndoe@example.com', 'dob' => '1996-01-01', 'extra' => $extra));
}
示例2: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Teacher::create(['name' => $faker->firstName, 'lastName' => $faker->lastName, 'dob' => $faker->date(), 'pob' => $faker->city, 'gender' => $faker->word, 'email' => $faker->email, 'password' => Hash::make('buffer'), 'grade' => $faker->word]);
}
}
示例3: add_teacher_POST
function add_teacher_POST()
{
$name = _post('name');
$gender = _post('gender');
$description = _post('description');
if ($name && $gender) {
$teacher = Teacher::create(compact('name', 'gender', 'description'));
redirect('teacher/' . $teacher->id);
} else {
show_form();
}
}
示例4: function
});
// 顯示新增教師表單
Route::get('/add/{titleId}', function ($titleId) {
$viewData['titleId'] = $titleId;
$viewData['teacher'] = null;
return View::make('account_form')->with($viewData);
});
// 執行新增教師
Route::post('/add/{titleId}', function ($titleId) {
$validator = FormValidator::teacher(Input::all(), true);
if ($validator->fails()) {
return Redirect::to('/account/add/' . $titleId)->withInput()->withErrors($validator)->with('message', '輸入錯誤,請檢查');
} else {
$data = Input::except('teacher_password', 'teacher_password_confirmation');
$data['teacher_password_hash'] = Hash::make(Input::get('teacher_password'));
if (Teacher::create($data)) {
$message = '新增教師《' . $data['teacher_name'] . '》完成';
} else {
$message = '資料寫入錯誤';
}
Teacher::syncClasses();
return Redirect::to('account/view_title/' . Teacher::getLastTitleId())->with('message', $message);
}
});
// 顯示編輯教師表單
Route::get('/edit/{id}/titleId/{titleId}', function ($id, $titleId) {
$viewData['teacher'] = Teacher::find($id);
$viewData['titleId'] = $titleId;
$viewData['teacherCourseunit'] = $viewData['teacher']->courseunit;
return View::make('account_form')->with($viewData);
});
示例5: run
public function run()
{
//DB::table('teachers')->delete();
$user = Teacher::create(array('id' => 1, 'id_user' => 3, 'first_name' => 'Luis', 'last_name' => 'Luna', 'birthdate' => '1984/05/22', 'gender' => 'male', 'language' => 'spanish', 'country' => 'Colombia', 'phone_number' => '222-2222', 'cellphone_number' => '444-4444-444'));
}
示例6: Student
$count = $user->findWithUsername($record['username']);
if ($count == false) {
try {
$user->create($record);
if ($group == 'S') {
try {
$student = new Student();
$student->create(array('user_id' => $user_id));
} catch (Exception $e) {
$e->getMessage();
}
} else {
if ($group == 'T') {
try {
$teacher = new Teacher();
$teacher->create(array('user_id' => $user_id));
} catch (Exception $e) {
$e->getMessage();
}
}
}
$result['successNum'] += 1;
} catch (Exception $e) {
$result['failedNum'] += 1;
$result['message'][] = $record['username'] . ' : 重复创建账号';
}
} else {
$result['failedNum'] += 1;
$result['message'][] = $record['username'] . ' : 重复创建账号';
}
}
示例7: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Eloquent::unguard();
// $this->call('UserTableSeeder');
DB::table('log_types')->delete();
LogType::create(array('name' => 'Inicio de sesión'));
LogType::create(array('name' => 'Cierre de sesión'));
LogType::create(array('name' => 'Registro/Creación'));
LogType::create(array('name' => 'Edición'));
LogType::create(array('name' => 'Eliminación/Cancelación/Inhabilitación'));
LogType::create(array('name' => 'Habilitación'));
LogType::create(array('name' => 'Subida de documento al servidor'));
LogType::create(array('name' => 'Eliminación de documento del servidor'));
LogType::create(array('name' => 'Descarga de documento'));
LogType::create(array('name' => 'Error de permisos'));
DB::table('users')->delete();
$user_webmaster = User::create(array('dni' => '73128679', 'email' => 'diego200039@hotmail.com', 'password' => Hash::make('12345678')));
$user_director = User::create(array('dni' => '22222222', 'email' => '', 'password' => Hash::make('12345678')));
DB::table('teachers')->delete();
$director = Teacher::create(array('names' => 'Julia', 'lastname' => 'Malpartida Llanos', 'state' => 'A', 'birthdate' => date('Y-m-d', strtotime('1960-07-20')), 'user_id' => $user_director->id));
DB::table('profiles')->delete();
$prof_webmaster = Profile::create(array('name' => 'webmaster', 'description' => 'Administrador del sitio'));
$prof_director = Profile::create(array('name' => 'Director', 'description' => ''));
$prof_tutor = Profile::create(array('name' => 'Tutor', 'description' => ''));
$prof_profesor = Profile::create(array('name' => 'Profesor', 'description' => ''));
$prof_administrativo = Profile::create(array('name' => 'Personal Administrativo', 'description' => ''));
$prof_alumno = Profile::create(array('name' => 'Alumno', 'description' => ''));
DB::table('actions')->delete();
$nav_anho_escolar = Action::create(array('name' => 'nav_anho_escolar', 'description' => ''));
$side_nuevo_anho_escolar = Action::create(array('name' => 'side_nuevo_anho_escolar', 'description' => ''));
$side_listar_anhos_escolares = Action::create(array('name' => 'side_listar_anhos_escolares', 'description' => ''));
$nav_matricula = Action::create(array('name' => 'nav_matricula', 'description' => ''));
$side_aprobar_pre_inscripciones = Action::create(array('name' => 'side_aprobar_pre_inscripciones', 'description' => ''));
$side_aprobar_matriculas_online = Action::create(array('name' => 'side_aprobar_matriculas_online', 'description' => ''));
$side_matricula_offline = Action::create(array('name' => 'side_matricula_offline', 'description' => ''));
$side_subir_lista_utiles = Action::create(array('name' => 'side_subir_lista_utiles', 'description' => ''));
$side_matricularse = Action::create(array('name' => 'side_matricularse', 'description' => ''));
$side_mis_matriculas = Action::create(array('name' => 'side_mis_matriculas', 'description' => ''));
$nav_niveles_cursos = Action::create(array('name' => 'nav_niveles_cursos', 'description' => ''));
$side_nuevo_nivel = Action::create(array('name' => 'side_nuevo_nivel', 'description' => ''));
$side_listar_niveles = Action::create(array('name' => 'side_listar_niveles', 'description' => ''));
/*$nav_cursos = Action::create(array(
'name' => 'nav_cursos',
'description' => ''
));*/
$side_nuevo_curso = Action::create(array('name' => 'side_nuevo_curso', 'description' => ''));
/*$side_listar_cursos = Action::create(array(
'name' => 'side_listar_cursos',
'description' => ''
));*/
$side_armar_horario = Action::create(array('name' => 'side_armar_horario', 'description' => ''));
$nav_horarios = Action::create(array('name' => 'nav_horarios', 'description' => ''));
$side_mi_horario = Action::create(array('name' => 'side_mi_horario', 'description' => ''));
$nav_tareas = Action::create(array('name' => 'nav_tareas', 'description' => ''));
$side_nueva_tarea = Action::create(array('name' => 'side_nueva_tarea', 'description' => ''));
$side_ver_tareas = Action::create(array('name' => 'side_ver_tareas', 'description' => ''));
// EL TUTOR PUEDE VER LAS TAREAS DE TODOS LOS CURSOS DE SU NIVEL
$side_mis_tareas = Action::create(array('name' => 'side_mis_tareas', 'description' => ''));
$nav_notas = Action::create(array('name' => 'nav_notas', 'description' => ''));
$side_registrar_notas = Action::create(array('name' => 'side_registrar_notas', 'description' => ''));
$side_ver_notas = Action::create(array('name' => 'side_ver_notas', 'description' => ''));
// EL TUTOR PUEDE VER LAS NOTAS DE TODOS LOS CURSOS DE SU NIVEL
$side_mis_notas = Action::create(array('name' => 'side_mis_notas', 'description' => ''));
$nav_personas = Action::create(array('name' => 'nav_personas', 'description' => ''));
$side_nuevo_alumno = Action::create(array('name' => 'side_nuevo_alumno', 'description' => ''));
$side_listar_alumnos = Action::create(array('name' => 'side_listar_alumnos', 'description' => ''));
$side_nuevo_profesor = Action::create(array('name' => 'side_nuevo_profesor', 'description' => ''));
$side_listar_profesores = Action::create(array('name' => 'side_listar_profesores', 'description' => ''));
$side_nuevo_personal_administrativo = Action::create(array('name' => 'side_nuevo_personal_administrativo', 'description' => ''));
$side_listar_personal_administrativo = Action::create(array('name' => 'side_listar_personal_administrativo', 'description' => ''));
$nav_libreta_control = Action::create(array('name' => 'nav_libreta_control', 'description' => ''));
$side_nueva_anotacion = Action::create(array('name' => 'side_nueva_anotacion', 'description' => ''));
$side_ver_anotaciones = Action::create(array('name' => 'side_ver_anotaciones', 'description' => ''));
$side_mis_anotaciones = Action::create(array('name' => 'side_mis_anotaciones', 'description' => ''));
$nav_comunicados = Action::create(array('name' => 'nav_comunicados', 'description' => ''));
$side_nuevo_comunicado = Action::create(array('name' => 'side_nuevo_comunicado', 'description' => ''));
$side_ver_comunicados = Action::create(array('name' => 'side_ver_comunicados', 'description' => ''));
$nav_usuarios = Action::create(array('name' => 'nav_usuarios', 'description' => ''));
/*$side_nuevo_usuario = Action::create(array(
'name' => 'side_nuevo_usuario',
'description' => ''
));*/
$side_listar_usuarios = Action::create(array('name' => 'side_listar_usuarios', 'description' => ''));
$nav_sistema = Action::create(array('name' => 'nav_sistema', 'description' => ''));
/*$side_nuevo_perfil = Action::create(array(
'name' => 'side_nuevo_perfil',
'description' => ''
));*/
$side_listar_perfiles = Action::create(array('name' => 'side_listar_perfiles', 'description' => ''));
$side_reporte_log = Action::create(array('name' => 'side_reporte_log', 'description' => ''));
DB::table('profile_actions')->delete();
$prof_webmaster->actions()->attach($nav_anho_escolar->id);
$prof_webmaster->actions()->attach($side_nuevo_anho_escolar->id);
$prof_webmaster->actions()->attach($side_listar_anhos_escolares->id);
$prof_webmaster->actions()->attach($nav_matricula->id);
//.........这里部分代码省略.........