本文整理汇总了PHP中Subject::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Subject::create方法的具体用法?PHP Subject::create怎么用?PHP Subject::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subject
的用法示例。
在下文中一共展示了Subject::create方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
DB::table('subjects')->delete();
Subject::create(array('subjectcode' => 'SC6', 'grade' => '6', 'subjectname' => 'Science'));
Subject::create(array('subjectcode' => 'MA6', 'grade' => '6', 'subjectname' => 'Maths'));
Subject::create(array('subjectcode' => 'HI6', 'grade' => '6', 'subjectname' => 'History'));
Subject::create(array('subjectcode' => 'EN6', 'grade' => '6', 'subjectname' => 'English'));
Subject::create(array('subjectcode' => 'GE6', 'grade' => '6', 'subjectname' => 'Geography'));
Subject::create(array('subjectcode' => 'CI6', 'grade' => '6', 'subjectname' => 'Citizenship Education'));
Subject::create(array('subjectcode' => 'TA6', 'grade' => '6', 'subjectname' => 'Tamil'));
Subject::create(array('subjectcode' => 'SI6', 'grade' => '6', 'subjectname' => 'Sinhala'));
Subject::create(array('subjectcode' => 'HS6', 'grade' => '6', 'subjectname' => 'Health Science'));
Subject::create(array('subjectcode' => 'SC7', 'grade' => '7', 'subjectname' => 'Science'));
Subject::create(array('subjectcode' => 'MA7', 'grade' => '7', 'subjectname' => 'Maths'));
Subject::create(array('subjectcode' => 'HI7', 'grade' => '7', 'subjectname' => 'History'));
Subject::create(array('subjectcode' => 'EN7', 'grade' => '7', 'subjectname' => 'English'));
Subject::create(array('subjectcode' => 'GE7', 'grade' => '7', 'subjectname' => 'Geography'));
Subject::create(array('subjectcode' => 'CI7', 'grade' => '7', 'subjectname' => 'Citizenship Education'));
Subject::create(array('subjectcode' => 'TA7', 'grade' => '7', 'subjectname' => 'Tamil'));
Subject::create(array('subjectcode' => 'SI7', 'grade' => '7', 'subjectname' => 'Sinhala'));
Subject::create(array('subjectcode' => 'HS7', 'grade' => '7', 'subjectname' => 'Health Science'));
Subject::create(array('subjectcode' => 'SC8', 'grade' => '8', 'subjectname' => 'Science'));
Subject::create(array('subjectcode' => 'MA8', 'grade' => '8', 'subjectname' => 'Maths'));
Subject::create(array('subjectcode' => 'HI8', 'grade' => '8', 'subjectname' => 'History'));
Subject::create(array('subjectcode' => 'EN8', 'grade' => '8', 'subjectname' => 'English'));
Subject::create(array('subjectcode' => 'GE8', 'grade' => '8', 'subjectname' => 'Geography'));
Subject::create(array('subjectcode' => 'CI8', 'grade' => '8', 'subjectname' => 'Citizenship Education'));
Subject::create(array('subjectcode' => 'TA8', 'grade' => '8', 'subjectname' => 'Tamil'));
Subject::create(array('subjectcode' => 'SI8', 'grade' => '8', 'subjectname' => 'Sinhala'));
Subject::create(array('subjectcode' => 'HS8', 'grade' => '8', 'subjectname' => 'Health Science'));
Subject::create(array('subjectcode' => 'SC9', 'grade' => '9', 'subjectname' => 'Science'));
Subject::create(array('subjectcode' => 'MA9', 'grade' => '9', 'subjectname' => 'Maths'));
Subject::create(array('subjectcode' => 'HI9', 'grade' => '9', 'subjectname' => 'History'));
Subject::create(array('subjectcode' => 'EN9', 'grade' => '9', 'subjectname' => 'English'));
Subject::create(array('subjectcode' => 'GE9', 'grade' => '9', 'subjectname' => 'Geography'));
Subject::create(array('subjectcode' => 'CI9', 'grade' => '9', 'subjectname' => 'Citizenship Education'));
Subject::create(array('subjectcode' => 'TA9', 'grade' => '9', 'subjectname' => 'Tamil'));
Subject::create(array('subjectcode' => 'SI9', 'grade' => '9', 'subjectname' => 'Sinhala'));
Subject::create(array('subjectcode' => 'HS9', 'grade' => '9', 'subjectname' => 'Health Science'));
Subject::create(array('subjectcode' => 'SC10', 'grade' => '10', 'subjectname' => 'Science'));
Subject::create(array('subjectcode' => 'MA10', 'grade' => '10', 'subjectname' => 'Maths'));
Subject::create(array('subjectcode' => 'HI10', 'grade' => '10', 'subjectname' => 'History'));
Subject::create(array('subjectcode' => 'EN10', 'grade' => '10', 'subjectname' => 'English'));
Subject::create(array('subjectcode' => 'TA10', 'grade' => '10', 'subjectname' => 'Tamil'));
Subject::create(array('subjectcode' => 'SI10', 'grade' => '10', 'subjectname' => 'Sinhala'));
Subject::create(array('subjectcode' => 'SC11', 'grade' => '11', 'subjectname' => 'Science'));
Subject::create(array('subjectcode' => 'MA11', 'grade' => '11', 'subjectname' => 'Maths'));
Subject::create(array('subjectcode' => 'HI11', 'grade' => '11', 'subjectname' => 'History'));
Subject::create(array('subjectcode' => 'EN11', 'grade' => '11', 'subjectname' => 'English'));
Subject::create(array('subjectcode' => 'TA11', 'grade' => '11', 'subjectname' => 'Tamil'));
Subject::create(array('subjectcode' => 'SI11', 'grade' => '11', 'subjectname' => 'Sinhala'));
Subject::create(array('subjectcode' => 'CM12', 'grade' => '12', 'subjectname' => 'Combined Maths'));
Subject::create(array('subjectcode' => 'C12', 'grade' => '12', 'subjectname' => 'Chemistry'));
Subject::create(array('subjectcode' => 'P12', 'grade' => '12', 'subjectname' => 'Physics'));
Subject::create(array('subjectcode' => 'B12', 'grade' => '12', 'subjectname' => 'Bio Science'));
Subject::create(array('subjectcode' => 'ET12', 'grade' => '12', 'subjectname' => 'Engineering Technology'));
Subject::create(array('subjectcode' => 'ST12', 'grade' => '12', 'subjectname' => 'Science For Technology'));
Subject::create(array('subjectcode' => 'IT12', 'grade' => '12', 'subjectname' => 'Information Communication Technology'));
}
示例2: doInsert
function doInsert()
{
if (isset($_POST['savecourse'])) {
if ($_POST['subjcode'] == "" or $_POST['subjdesc'] == "" or $_POST['unit'] == "") {
message("All field is required!", "error");
check_message();
} else {
$subj = new Subject();
$subjcode = $_POST['subjcode'];
$subjdesc = $_POST['subjdesc'];
$unit = $_POST['unit'];
$pre = $_POST['pre'];
$course = $_POST['course'];
$ay = $_POST['ay'];
$Semester = $_POST['Semester'];
$subj->SUBJ_CODE = $subjcode;
$subj->SUBJ_DESCRIPTION = $subjdesc;
$subj->UNIT = $unit;
$subj->PRE_REQUISITE = $pre;
$subj->COURSE_ID = $course;
$subj->AY = $ay;
$subj->SEMESTER = $Semester;
$istrue = $subj->create();
if ($istrue == 1) {
message("New Subject created successfully!", "success");
redirect('index.php');
}
}
} elseif (isset($_POST['saveandnewcourse'])) {
if ($_POST['subjcode'] == "" or $_POST['subjdesc'] == "" or $_POST['unit'] == "") {
message("All field is required!", "error");
check_message();
} else {
$subj = new Subject();
$subjcode = $_POST['subjcode'];
$subjdesc = $_POST['subjdesc'];
$unit = $_POST['unit'];
$pre = $_POST['pre'];
$course = $_POST['course'];
$ay = $_POST['ay'];
$Semester = $_POST['Semester'];
$subj->SUBJ_CODE = $subjcode;
$subj->SUBJ_DESCRIPTION = $subjdesc;
$subj->UNIT = $unit;
$subj->PRE_REQUISITE = $pre;
$subj->COURSE_ID = $course;
$subj->AY = $ay;
$subj->SEMESTER = $Semester;
$istrue = $subj->create();
if ($istrue == 1) {
message("New Subject created successfully!", "success");
redirect('index.php?view=add');
}
}
}
}
示例3: run
public function run()
{
DB::table('subjects')->delete();
Subject::create(array('name' => 'Algorithm Design and Analysis', 'sem' => 4));
Subject::create(array('name' => 'Computer Organization', 'sem' => 4));
Subject::create(array('name' => 'Graph Theory', 'sem' => 4));
Subject::create(array('name' => 'Mathematics 4', 'sem' => 4));
Subject::create(array('name' => 'Micro-Processors', 'sem' => 4));
Subject::create(array('name' => 'Unix', 'sem' => 4));
}
示例4: store
/**
* Guarda un nuevo objetivo en la base de datos
*
* @return Response
*/
public function store($admin)
{
$validator = Validator::make($data = Input::all(), Subject::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
} else {
Subject::create($data);
$this->log_action('Objetivo Creado', 'El objetivo "' . Input::get('name') . '" ha sido creado.');
Session::flash('msj', 'El objetivo ha sido creado exitosamente.');
return Redirect::route('admin.index', compact('admin'));
}
}
示例5: trim
}
$course_id = Course::get_by_sql("SELECT * FROM " . T_COURSES . " WHERE " . C_COURSE_CODE . "='" . trim($_POST['course_code']) . "'")[0]->id;
$rows = Subject::get_by_sql("SELECT * FROM " . T_SUBJECTS . " WHERE " . C_SUBJECT_CODE . "='" . $_POST['code'] . "' AND " . C_SUBJECT_COURSE_ID . "=" . $course_id);
if ($_POST['oper'] == 'add') {
if (count($rows) > 0) {
die("exists");
}
$subject = new Subject();
$subject->code = $_POST['code'];
$subject->description = $_POST['description'];
$subject->units = $_POST['units'];
$subject->prereq_subject_id = $prereq_subject_id;
$subject->course_id = $course_id;
$subject->year = $_POST['year'];
$subject->semester = $_POST['semester'];
$subject->curriculum_id = $_POST['curriculum_id'];
$subject->create();
} else {
if ($_POST['oper'] == 'edit') {
$subject = Subject::get_by_id($_POST['id']);
$subject->code = $_POST['code'];
$subject->description = $_POST['description'];
$subject->units = $_POST['units'];
$subject->prereq_subject_id = $prereq_subject_id;
$subject->course_id = $course_id;
$subject->year = $_POST['year'];
$subject->semester = $_POST['semester'];
$subject->curriculum_id = $_POST['curriculum_id'];
$subject->update();
}
}