本文整理汇总了PHP中Student::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Student::create方法的具体用法?PHP Student::create怎么用?PHP Student::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Student
的用法示例。
在下文中一共展示了Student::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Student::create(['name' => $faker->firstName, 'lastName' => $faker->lastName, 'dob' => $faker->date(), 'pob' => $faker->city, 'gender' => $faker->word, 'email' => $faker->email, 'password' => Hash::make('buffer'), 'level' => 'L' . $faker->randomNumber(1), 'option' => $faker->word, 'section' => $faker->randomNumber(1), 'group' => $faker->randomNumber(2), 'subGroup' => $faker->randomNumber(2)]);
}
}
示例2: run
public function run()
{
DB::table('students')->delete();
$extra = array('1', '2', '3', '4');
$extra = serialize($extra);
Student::create(array('user_id' => 1, 'email' => 'johndoe@example.com', 'dob' => '1996-01-01', 'extra' => $extra));
}
示例3: store
/**
* Store a newly created student in storage.
*
* @return Response
*/
public function store()
{
$validator = Validator::make($data = Input::all(), Student::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
Student::create($data);
return Redirect::route('students.index');
}
示例4: create
public static function create($data)
{
session_start();
$headers = apache_request_headers();
$token = $headers['X-Auth-Token'];
if (!$headers['X-Auth-Token']) {
header('Invalid CSRF Token', true, 401);
return print json_encode(array('success' => false, 'status' => 400, '1msg' => 'Invalid CSRF Token / Bad Request / Unauthorized ... Please Login again'), JSON_PRETTY_PRINT);
die;
} else {
if ($token != $_SESSION['form_token']) {
header('Invalid CSRF Token', true, 401);
return print json_encode(array('success' => false, 'status' => 400, 'msg' => 'Invalid CSRF Token / Bad Request / Unauthorized ... Please Login again'), JSON_PRETTY_PRINT);
die;
} else {
if (isset($data['studid']) && empty($data['studid'])) {
return print json_encode(array('success' => false, 'status' => 200, 'msg' => 'Student ID is required'), JSON_PRETTY_PRINT);
die;
} else {
if (isset($data['fname']) && empty($data['fname'])) {
return print json_encode(array('success' => false, 'status' => 200, 'msg' => 'Student Firstname is required'), JSON_PRETTY_PRINT);
die;
} else {
if (isset($data['lname']) && empty($data['lname'])) {
return print json_encode(array('success' => false, 'status' => 200, 'msg' => 'Student Lastname is required'), JSON_PRETTY_PRINT);
die;
} else {
if (isset($data['mobileno']) && empty($data['mobileno'])) {
return print json_encode(array('success' => false, 'status' => 200, 'msg' => 'Mobile No. is required'), JSON_PRETTY_PRINT);
die;
} else {
if (isset($data['email']) && empty($data['email'])) {
return print json_encode(array('success' => false, 'status' => 200, 'msg' => 'Email Address is required'), JSON_PRETTY_PRINT);
die;
} else {
if (isset($data['username']) && empty($data['username'])) {
return print json_encode(array('success' => false, 'status' => 200, 'msg' => 'Username is required'), JSON_PRETTY_PRINT);
die;
} else {
if (isset($data['password']) && empty($data['password'])) {
return print json_encode(array('success' => false, 'status' => 200, 'msg' => 'Password is required'), JSON_PRETTY_PRINT);
die;
} else {
$var = ['studid' => $data['studid'], 'fname' => $data['fname'], 'lname' => $data['lname'], 'mobileno' => $data['mobileno'], 'username' => $data['username'], 'password' => $data['password'], 'email' => $data['email'], 'address' => $data['address'], 'birthdate' => $data['birthdate'], 'graduated' => $data['graduated'], 'last_school' => $data['last_school'], 'pref_course' => $data['pref_course'], 'gender' => $data['gender'], 'level' => 'Student'];
Student::create($var);
}
}
}
}
}
}
}
}
}
}
示例5: postSignup
public function postSignup()
{
$data = Input::all();
//SignUp Validation
$validator = Validator::make($data, Student::$signupRules, Student::$messages);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
//Hashing The Password
$data['password'] = Hash::make($data['password']);
//Creating a new Student
$student = Student::create($data);
return Redirect::route('student.dashboard');
}
示例6: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$users = [['f_name' => 'John', 'l_name' => 'Doe', 'email' => 'john@doe.com', 'password' => bcrypt('password'), 'semester_id' => 13, 'department' => 'EEE', 'phone' => '+8801760099824'], ['f_name' => 'Jane', 'l_name' => 'Diana', 'email' => 'jane@diana.com', 'password' => bcrypt('password'), 'semester_id' => 7, 'department' => 'BBS', 'phone' => '+8801760099824'], ['f_name' => 'Martha', 'l_name' => 'Jane', 'email' => 'martha@jane.com', 'password' => bcrypt('password'), 'semester_id' => 10, 'department' => 'ESS', 'phone' => '+8801760099824'], ['f_name' => 'Jeffery', 'l_name' => 'Way', 'email' => 'jeff@way.com', 'password' => bcrypt('password'), 'semester_id' => 9, 'department' => 'SECS', 'phone' => '+8801760099824', 'role' => 'faculty'], ['f_name' => 'Abdur', 'l_name' => 'Rahman', 'email' => 'adnan@bracu.ac.bd', 'password' => bcrypt('password'), 'semester_id' => 5, 'department' => 'SECS', 'phone' => '+8801760099824', 'role' => 'faculty'], ['f_name' => 'Atef', 'l_name' => 'Haque', 'email' => 'atefth@gmail.com', 'password' => bcrypt('password'), 'semester_id' => 15, 'department' => 'EEE', 'phone' => '+8801760099824', 'role' => 'admin']];
$students = [['student_id' => '10101010', 'id' => 1, 'major' => 'EEE'], ['student_id' => '00701020', 'id' => 2, 'major' => 'BBS'], ['student_id' => '10212020', 'id' => 3, 'major' => 'ES']];
$faculties = [['id' => 4, 'faculty_id' => '05603012'], ['id' => 5, 'faculty_id' => '04050205']];
$admins = [['id' => 6, 'admin_id' => '04030204']];
foreach ($users as $key => $user) {
User::create($user);
}
foreach ($students as $key => $student) {
Student::create($student);
}
foreach ($faculties as $key => $faculty) {
Faculty::create($faculty);
}
foreach ($admins as $key => $admin) {
Admin::create($admin);
}
}
示例7: array
$portraits = 'hp_defalut_stu_male.png';
}
if (Input::get('passwordType') == 'default_password') {
$record = array('username' => $value['A'], 'password' => Hash::make($value['A'], $salt), 'salt' => $salt, 'name' => $value['B'], 'sex' => $value['C'], 'joined' => date('Y-m-d H:i:s'), 'portraits' => $portraits, 'group' => $value['D']);
} else {
$record = array('username' => $value['A'], 'password' => Hash::make(Input::get('defined_password'), $salt), 'salt' => $salt, 'name' => $value['B'], 'sex' => $value['C'], 'joined' => date('Y-m-d H:i:s'), 'portraits' => $portraits, 'group' => $value['D']);
}
$user = new User();
$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) {
示例8: postNewVoter
public function postNewVoter()
{
//verify the user input and create account
$validator = Validator::make(Input::all(), array('Identity_No' => 'required', 'Email' => 'required|email', 'Phone_Number' => 'required', 'First_Name' => 'required', 'Last_Name' => 'required', 'Faculty' => 'required', 'Residence' => 'required', 'Photo_1' => 'image|required|mimes:jpeg,bmp,png', 'Photo_2' => 'image|required|mimes:jpeg,bmp,png', 'Photo_3' => 'image|required|mimes:jpeg,bmp,png'));
if ($validator->fails()) {
return Redirect::route('admin-new-voter-get')->withErrors($validator)->withInput()->with('globalerror', 'Sorry!! The Data was not Saved, please retry');
} else {
$identitynumber = Input::get('Identity_No');
$email = Input::get('Email');
$phonenumber = Input::get('Phone Numer');
$firstname = Input::get('First_Name');
$lastname = Input::get('Last_Name');
$faculty_id = Input::get('Faculty');
$residence_id = Input::get('Residence');
$photo_1 = Input::file('Photo_1');
$photo_2 = Input::file('Photo_2');
$photo_3 = Input::file('Photo_3');
//register the new user
$newuser = User::create(array('Identity_No' => $identitynumber, 'First_Name' => $firstname, 'Last_Name' => $lastname, 'Password' => Hash::make($identitynumber), 'Active' => TRUE, 'User_Level' => 'voter'));
//register the new user contact
$newcontact = Contact::create(array('Email' => $email, 'Phone_Number' => $phonenumber));
//Save the three Photos
$photo1 = $this->postPhoto($photo_1, $newuser->id);
$photo2 = $this->postPhoto($photo_2, $newuser->id);
$photo3 = $this->postPhoto($photo_3, $newuser->id);
$newphotos = Photo::create(array('photo_1' => $photo1, 'photo_2' => $photo2, 'photo_3' => $photo3));
//save the details to the students table
$newstudent = Student::create(array('Users_Id' => $newuser->id, 'Faculties_Id' => $faculty_id, 'Residences_Id' => $residence_id, 'Contacts_Id' => $newcontact->id, 'Photos_Id' => $newphotos->id, 'Active' => TRUE));
if ($newuser && $newcontact && $newphotos && $newstudent) {
//update the eigenfaces model with to include the new facedata
putenv("PYTHONPATH=/usr/lib/python2.7");
putenv("LD_LIBRARY_PATH=/usr/local/lib");
//call python class to create the eigenfaces models from the existing photos
exec("python /opt/lampp/htdocs/jkuatvs/eigensave.py /opt/lampp/htdocs/jkuatvs/photos");
return Redirect::route('admin-new-voter-get')->with('globalsuccess', 'New Voter Details Have been Added');
}
}
}
示例9: postRegistration
public function postRegistration()
{
$validator = Validator::make(Input::all(), array('first' => 'required|alpha', 'last' => 'required|alpha', 'rollnumber' => 'required|integer', 'branch' => 'required|between:0,10', 'year' => 'required|integer', 'email' => 'required|email', 'category' => 'required|between:0,5'));
if ($validator->fails()) {
return Redirect::route('student-registration')->withErrors($validator)->withInput();
// fills the field with the old inputs what were correct
} else {
$student = Student::create(array('first_name' => Input::get('first'), 'last_name' => Input::get('last'), 'category' => Input::get('category'), 'roll_num' => Input::get('rollnumber'), 'branch' => Input::get('branch'), 'year' => Input::get('year'), 'email_id' => Input::get('email')));
if ($student) {
return Redirect::route('student-registration')->with('global', 'Your request has been raised, you will be soon approved!');
}
}
}
示例10: AppointmentDetail
//----------------------------------------------------------------------------------------------------------------------------------//
$appointmentDetail = new AppointmentDetail();
$appointmentDetail->studentid = "0";
$appointmentDetail->visitschedule = strtotime($_POST['g_visitschedule']);
$appointmentDetail->visitpurpose = $_POST['g_visitpurpose'];
$appointmentDetail->officer = $_POST['g_officer'];
$appointmentDetail->create();
//----------------------------------------------------------------------------------------------------------------------------------//
$student->personal_information_id = $personInfo->id;
$student->school_last_attended_id = $schoolLastAttended->id;
$student->inquiry_id = $inquiry->id;
$student->school_considered_id = $schoolConsidered->id;
$student->sti_discovery_id = $discovery->id;
$student->enrollment_detail_id = $enrollmentDetail->id;
$student->appointment_detail_id = $appointmentDetail->id;
$student->create();
//----------------------------------------------------------------------------------------------------------------------------------//
$appointmentDetail->studentid = $student->id;
$appointmentDetail->update();
$enrollmentDetail->studentid = $student->id;
$enrollmentDetail->update();
$discovery->studentid = $student->id;
$discovery->update();
$schoolConsidered->studentid = $student->id;
$schoolConsidered->update();
$inquiry->studentid = $student->id;
$inquiry->update();
$schoolLastAttended->studentid = $student->id;
$schoolLastAttended->update();
$personInfo->studentid = $student->id;
$personInfo->update();
示例11: Student
$conn = $database->getConnection();
// instantiate a new student object
$student = new Student($conn);
//store in the object's properties what the user typed in the form.
$student->stud_name = $_POST['ustud_name'];
$student->gender = $_POST['ugender'];
$student->prog_id = $_POST['uprog_id'];
$student->quarter = $_POST['uquarter'];
$student->award = $_POST['uaward'];
$student->description = $_POST['udescription'];
$student->image = $_FILES['uimage'];
//Perform the following query based on the information provided by the user
?>
<div class="msg-container-add">
<?php
if ($student->create($_POST['ugender'])) {
echo '<p class="success">Student record has been added.</p>';
} else {
//otherwise show 'fail' feedback
echo '<p class="danger">ERROR: Student record has NOT been added.</p>';
}
}
//END THE ADD ROW
?>
</div>
<?php
}
//END THE POST. Now in all cases show them the form...
?>
<form action="<?php
示例12: actionSignup
public function actionSignup()
{
if (isset($_POST['register'])) {
if (isValidName($_POST['fname']) != "ok") {
$_SESSION['err_code'] = 5;
$_SESSION['fname'] = $_POST['fname'];
$_SESSION['error'] = isValidName($_POST['fname']);
header("location: {$_SERVER['HTTP_REFERER']}");
exit;
}
if (isValidName($_POST['lname']) != "ok") {
$_SESSION['err_code'] = 6;
$_SESSION['lname'] = $_POST['lname'];
$_SESSION['error'] = isValidName($_POST['lname']);
//header("location: {$_SERVER['HTTP_REFERER']}");
exit;
}
if (trim($_POST['email']) == "" || filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) == false) {
$_SESSION['err_code'] = 7;
$_SESSION['email'] = $_POST['email'];
$_SESSION['error'] = "Invalid email provided";
header("location: {$_SERVER['HTTP_REFERER']}");
exit;
}
if (User::checker($_POST['email']) != 0) {
$_SESSION['error'] = "Sorry, a user already exists with the email you provided. Forgot your password? <a href='#'>Get a new one</a>";
header("location: {$_SERVER['HTTP_REFERER']}");
exit;
}
if (trim($_POST['password']) == "") {
$_SESSION['error'] = "Password field cannot be blank!";
header("location: {$_SERVER['HTTP_REFERER']}");
exit;
}
if ($_POST['location'] == "") {
$_SESSION['error'] = "Specify your location";
header("location: {$_SERVER['HTTP_REFERER']}");
exit;
}
if (isset($_POST['tel'])) {
if (trim($_POST['tel']) != "" && isPhoneNumber($_POST['tel'] != true)) {
$_SESSION['err_code'] = 8;
$_SESSION['tel'] = $_POST['tel'];
$_SESSION['error'] = isPhoneNumber($_POST['tel']);
header("location: {$_SERVER['HTTP_REFERER']}");
exit;
}
}
$x = new Student($_POST);
$x->utype = $this->user_type;
if ($x->create() !== true) {
$_SESSION['error'] = "Ooops! Something went wrong! Please try later";
} else {
UserController::redirectToLogin("Account has been created. Please signin to continue");
}
header("location: {$_SERVER['HTTP_REFERER']}");
exit;
}
$type = $this->user_type;
//passed to the view for toggling
include __VIEWPATH__ . "student/signup.php";
}
示例13: header
require __DIR__ . '/../app/init.php';
$general->loggedOutProtect();
// redirect if user elevation is not that of secretary or admin
if ($user->isTutor()) {
header('Location: ' . BASE_URL . "error-403");
exit;
}
$pageTitle = "Academia - Students";
$section = "academia";
try {
$students = StudentFetcher::retrieveAll();
$majors = MajorFetcher::retrieveMajors();
$appointments = AppointmentFetcher::retrievePendingForAllStudents();
if (isBtnAddStudentPrsd()) {
$majorId = !empty($_POST['userMajorId']) ? $_POST['userMajorId'] : null;
Student::create($_POST['firstName'], $_POST['lastName'], $_POST['email'], $_POST['studentId'], $_POST['mobileNum'], $majorId, $_POST['ciInput'], $_POST['creditsInput']);
header('Location: ' . BASE_URL . "academia/students/success");
exit;
} else {
if (isBtnAddMajorPrsd()) {
Major::create($_POST['majorCode'], $_POST['majorName']);
header('Location: ' . BASE_URL . "academia/students/success");
} else {
if (isBtnUpdatePrsd()) {
if (!isset($_POST['idUpdate']) || ($oldStudentData = getStudent($_POST['idUpdate'], $students)) === false) {
throw new Exception("Data tempering detected. Process stopped.");
} else {
$id = $oldStudentData[StudentFetcher::DB_COLUMN_ID];
$newFirstName = $_POST['newFirstName'];
$newLastName = $_POST['newLastName'];
$newEmail = $_POST['newEmail'];
示例14: run
public function run()
{
//DB::table('students')->delete();
$user = Student::create(array('id' => 1, 'id_user' => 2, 'first_name' => 'Pedro', 'last_name' => 'Reyes', 'birthdate' => '1994/05/22', 'gender' => 'male', 'language' => 'spanish', 'country' => 'Colombia', 'phone_number' => '333-3333', 'cellphone_number' => '555-5555-555'));
}
示例15: doInsert
//.........这里部分代码省略.........
$student->LNAME = $LNAME;
$student->FNAME = $FNAME;
$student->MNAME = $MNAME;
$student->SEX = $SEX;
$student->BDAY = $BDAY;
$student->BPLACE = $BPLACE;
$student->STATUS = $STATUS;
$student->AGE = $AGE;
$student->NATIONALITY = $NATIONALITY;
$student->RELIGION = $RELIGION;
$student->CONTACT_NO = $CONTACT_NO;
$student->HOME_ADD = $HOME_ADD;
$student->EMAIL = $EMAIL;
//course infor
/*$course = $_POST['course'];
$semester = $_POST['semester'];
$ay = $_POST['AY'];
$sy = new Schoolyr();
$sy->AY = $ay;
$sy->SEMESTER = $semester;
$sy->COURSE_ID = $course;
$sy->IDNO = $IDNO;*/
/*if ($istrue) {
output_message('course info successfully added!');
redirect ('newstudent.php');
}
*/
//secondary Details
$FATHER = $_POST['father'];
$FATHER_OCCU = $_POST['fOccu'];
$MOTHER = $_POST['mother'];
$MOTHER_OCCU = $_POST['mOccu'];
$BOARDING = $_POST['boarding'];
$WITH_FAMILY = $_POST['withfamily'];
$GUARDIAN = $_POST['guardian'];
$GUARDIAN_ADDRESS = $_POST['guardianAdd'];
$OTHER_PERSON_SUPPORT = $_POST['otherperson'];
$ADDRESS = $_POST['otherAddress'];
$studdetails = new Student_details();
$studdetails->FATHER = $FATHER;
$studdetails->FATHER_OCCU = $FATHER_OCCU;
$studdetails->MOTHER = $MOTHER;
$studdetails->MOTHER_OCCU = $MOTHER_OCCU;
$studdetails->BOARDING = $BOARDING;
$studdetails->WITH_FAMILY = $WITH_FAMILY;
$studdetails->GUARDIAN = $GUARDIAN;
$studdetails->GUARDIAN_ADDRESS = $GUARDIAN_ADDRESS;
$studdetails->OTHER_PERSON_SUPPORT = $OTHER_PERSON_SUPPORT;
$studdetails->ADDRESS = $ADDRESS;
$studdetails->IDNO = $IDNO;
//
/*if ($istrue) {
output_message('Seccondary details successfully added!');
redirect ('newstudent.php');
}
*/
//requirements
$nso = isset($_POST['nso']) ? "Yes" : "No";
$bapt = isset($_POST['baptismal']) ? "Yes" : "No";
$entrance = isset($_POST['entrance']) ? "Yes" : "No";
$mir_contract = isset($_POST['mir_contract']) ? "Yes" : "No";
$certifcateOfTransfer = isset($_POST['certifcateOfTransfer']) ? "Yes" : "No";
$requirements = new Requirements();
$requirements->NSO = $nso;
$requirements->BAPTISMAL = $bapt;
$requirements->ENTRANCE_TEST_RESULT = $entrance;
$requirements->MARRIAGE_CONTRACT = $mir_contract;
$requirements->CERTIFICATE_OF_TRANSFER = $certifcateOfTransfer;
$requirements->IDNO = $IDNO;
//$istrue = $requirements->create();
/*if ($istrue) {
output_message('Student requirements successfully added!');
redirect ('newstudent.php');
}
*/
if ($IDNO == "") {
message('ID Number is required!', "error");
redirect('index.php?view=add');
} elseif ($LNAME == "") {
message('Last Name is required!', "error");
redirect('index.php?view=add');
} elseif ($FNAME == "") {
message('First Name is required!', "error");
redirect('index.php?view=add');
} elseif ($MNAME == "") {
message('Middle Name is required!', "error");
redirect('index.php?view=add');
} elseif ($EMAIL == "") {
message('Email address is required!', "error");
redirect('index.php?view=add');
} else {
$student->create();
#$sy->create();
$studdetails->create();
$requirements->create();
message('New student addedd successfully!', "success");
redirect('index.php?view=list');
}
}