本文整理汇总了PHP中School::create方法的典型用法代码示例。如果您正苦于以下问题:PHP School::create方法的具体用法?PHP School::create怎么用?PHP School::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类School
的用法示例。
在下文中一共展示了School::create方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
School::create([]);
}
}
示例2: run
public function run()
{
$faker = Faker\Factory::create();
for ($id = 1; $id < 19; $id++) {
School::create(['user_id' => $id, 'primary_name' => $faker->randomElement(['Jose Rizal University', 'Rizal Techonological University', 'La Salle', 'Ateneo de Manila', 'San Sebastian College', 'University of the Philippines', 'University of Santo Tomas']), 'primary_address' => $faker->streetAddress, 'primary_years' => '', 'secondary_name' => $faker->randomElement(['Jose Rizal University', 'Rizal Techonological University', 'La Salle', 'Ateneo de Manila', 'San Sebastian College', 'University of the Philippines', 'University of Santo Tomas']), 'secondary_address' => $faker->streetAddress, 'secondary_years' => '', 'tertiary_name' => $faker->randomElement(['Jose Rizal University', 'Rizal Techonological University', 'La Salle', 'Ateneo de Manila', 'San Sebastian College', 'University of the Philippines', 'University of Santo Tomas']), 'tertiary_address' => $faker->streetAddress, 'tertiary_years' => '']);
}
}
示例3: _ops_update
function _ops_update()
{
$OID = max(0, intval($_POST['OID']));
$CID = max(0, intval($_POST['CID']));
$msg = "";
loginRequireMgmt();
if (!loginCheckPermission(USER::MGMT_SCHOOL)) {
redirect("errors/401");
}
$itemName = "School";
$urlPrefix = "mgmt_school";
$object = new School();
if ($OID) {
$object->retrieve($OID, $CID);
if (!$object->exists()) {
$msg = "{$itemName} not found!";
} else {
transactionBegin();
$object->merge($_POST);
if ($object->update()) {
transactionCommit();
$msg = "{$itemName} updated!";
} else {
transactionRollback();
$msg = "{$itemName} update failed";
}
}
} else {
$object->merge($_POST);
transactionBegin();
if ($object->create()) {
transactionCommit();
$msg = "{$itemName} created!";
} else {
transactionRollback();
$msg = "{$itemName} Create failed";
}
}
redirect("{$urlPrefix}/manage", $msg);
}
示例4: postRegister
public function postRegister()
{
$validator = Validator::make(Input::all(), User::$rules);
if ($validator->fails()) {
return Redirect::route('register')->withErrors($validator)->withInput();
}
$user = User::create(['firstname' => Input::get('firstname'), 'middlename' => Input::get('middlename'), 'lastname' => Input::get('lastname'), 'email' => Input::get('email'), 'username' => Input::get('username'), 'password' => Hash::make(Input::get('password')), 'department_id' => Input::get('department_id'), 'birthday' => Input::get('birthday'), 'birthplace' => Input::get('birthplace'), 'gender' => Input::get('gender'), 'civilstatus' => Input::get('civilstatus'), 'citizenship' => Input::get('citizenship'), 'height' => Input::get('height'), 'weight' => Input::get('weight'), 'bloodtype' => Input::get('bloodtype'), 'datehired' => Input::get('datehired'), 'pos_id' => Input::get('pos_id'), 'status' => Input::get('status')]);
// $user->department()->attach(Input::get('department_id'));
$lastid = User::orderBy('id', 'desc')->first();
$contacts = ContactInfo::create(['user_id' => $lastid->id, 'homenum' => Input::get('homenum'), 'officenum' => Input::get('officenum'), 'mobilenum' => Input::get('mobilenum'), 'street' => Input::get('street'), 'city' => Input::get('city')]);
$commonid = CommonId::create(['user_id' => $lastid->id, 'tin' => input::get('taxid'), 'philhealth' => input::get('philhealth'), 'pagibig' => input::get('pagibig'), 'sss' => input::get('sss'), 'gsisbp' => input::get('gsisbp'), 'gsispolicy' => input::get('gsispol'), 'gsisoptional' => input::get('gsisopt'), 'educplan' => input::get('educplan')]);
$father = Parents::create(['user_id' => $lastid->id, 'parent_id' => Input::get('fatherid'), 'firstname' => Input::get('fatherfirstname'), 'middlename' => Input::get('fathermiddlename'), 'lastname' => Input::get('fatherlastname'), 'address' => Input::get('fatheraddress')]);
$mother = Parents::create(['user_id' => $lastid->id, 'parent_id' => Input::get('motherid'), 'firstname' => Input::get('motherfirstname'), 'middlename' => Input::get('mothermiddlename'), 'lastname' => Input::get('motherlastname'), 'address' => Input::get('motheraddress')]);
$vacleave = LeaveBalance::create(['user_id' => $lastid->id, 'balance' => 1.25, 'leavetype_id' => 1]);
$sickleave = LeaveBalance::create(['user_id' => $lastid->id, 'balance' => 1.25, 'leavetype_id' => 2]);
$patleave = LeaveBalance::create(['user_id' => $lastid->id, 'leavetype_id' => 3]);
$patleave = LeaveBalance::create(['user_id' => $lastid->id, 'leavetype_id' => 4]);
$birthleave = LeaveBalance::create(['user_id' => $lastid->id, 'leavetype_id' => 5]);
$school = School::create(['user_id' => $lastid->id]);
$evalpoints = EvaluatePoints::create(['user_id' => $lastid->id]);
$audit = AuditTrail::create(['user_id' => Auth::id(), 'role' => 'Employee Management Admin', 'action' => 'registered a new EMPLOYEE "' . $lastid->firstname . ' ' . $lastid->lastname . '".']);
return Redirect::route('register')->with('alert', 'success|' . $user->formatName(':fn :mi :ln') . ' has been registered successfully.');
}
示例5: doInsert
function doInsert()
{
if (isset($_POST['save'])) {
$NAME = $_POST['name'];
$SHORTNAME = $_POST['shortname'];
$ADDRESS = $_POST['address'];
$TELEPHONE = $_POST['telephone'];
$FAX = $_POST['fax'];
$DIRECTLINE = $_POST['directline'];
$EMAIL = $_POST['email'];
$WEBSITE = $_POST['website'];
$FACEBOOK = $_POST['facebook'];
$TWEETER = $_POST['tweeter'];
$GPLUS = $_POST['gplus'];
$YOUTUBE = $_POST['youtube'];
$LINKEDIN = $_POST['linkedin'];
$SKYPE = $_POST['skype'];
$BUREAU = $_POST['bureau'];
$EXTENSION = $_POST['extension'];
$school = new School();
$school->extension = $EXTENSION;
$school->name = $NAME;
$school->shortname = $SHORTNAME;
$school->address = $ADDRESS;
$school->telephone = $TELEPHONE;
$school->fax = $FAX;
$school->directline = $DIRECTLINE;
$school->email = $EMAIL;
$school->website = $WEBSITE;
$school->tweeter = $TWEETER;
$school->facebook = $FACEBOOK;
$school->gplus = $GPLUS;
$school->youtube = $YOUTUBE;
$school->linkedin = $LINKEDIN;
$school->skype = $SKYPE;
$school->bureau_id = $BUREAU;
}
if ($NAME == "") {
message('Name is required!', "error");
redirect('index.php?view=add');
} elseif ($SHORTNAME == "") {
message('Short Name is required!', "error");
redirect('index.php?view=add');
} elseif ($ADDRESS == "") {
message('Short Name is required!', "error");
redirect('index.php?view=add');
} elseif ($EXTENSION == "") {
message('Extension is required!', "error");
redirect('index.php?view=add');
} elseif ($TELEPHONE == "") {
message('Telephone is required!', "error");
redirect('index.php?view=add');
} elseif ($FAX == "") {
message('Fax is required!', "error");
redirect('index.php?view=add');
} elseif ($DIRECTLINE == "") {
message('Directline is required!', "error");
redirect('index.php?view=add');
} elseif ($EMAIL == "") {
message('Email is required!', "error");
redirect('index.php?view=add');
} elseif ($WEBSITE == "") {
message('Website is required!', "error");
redirect('index.php?view=add');
} elseif ($TWEETER == "") {
message('Tweeter is required!', "error");
redirect('index.php?view=add');
} elseif ($FACEBOOK == "") {
message('Facebook ID is required!', "error");
redirect('index.php?view=add');
} elseif ($GPLUS == "") {
message('Gplus is required!', "error");
redirect('index.php?view=add');
} elseif ($YOUTUBE == "") {
message('Youtube is required!', "error");
redirect('index.php?view=add');
} elseif ($LINKEDIN == "") {
message('Linkedin is required!', "error");
redirect('index.php?view=add');
} elseif ($SKYPE == "") {
message('Skype is required!', "error");
redirect('index.php?view=add');
} elseif ($BUREAU == "") {
message('Bureau is required!', "error");
redirect('index.php?view=add');
} else {
$school->create();
message('New school addedd successfully!', "success");
redirect('index.php?view=list');
}
}
示例6: File
$object->about = $_POST['about'];
$object->address = $_POST['address'];
$object->comments = $_POST['comments'];
$object->fbcomments = $_POST['fbcomments'];
$object->history = $_POST['history'];
$object->visionmission = $_POST['visionmission'];
$object->corevalues = $_POST['corevalues'];
$file = new File($_FILES['logo']);
if ($file->valid) {
$object->logo = $file->data;
}
$file = new File($_FILES['cover']);
if ($file->valid) {
$object->picture = $file->data;
}
$object->create();
$schooluser = new SchoolUser();
$schooluser->schoolid = $object->id;
$schooluser->userid = $session->user_id;
$schooluser->level = 1;
$schooluser->role = "admin";
$schooluser->enabled = 1;
$schooluser->pending = 0;
$schooluser->create();
$folder_path = "../../public/schools/";
mkdir($folder_path . $object->id . "/", 0700);
// schoolid folder
mkdir($folder_path . $object->id . "/yearbooks/", 0700);
// yearbook folder
$log = new Log($session->user_id, $clientip, "WEB", "CREATED SCHOOL: " . $object->id);
$log->create();
示例7: School
require_once "../../includes/initialize.php";
global $session;
if (!$session->is_logged_in()) {
redirect_to("../../index.php");
}
if ($_POST['oper'] == 'add') {
$school = new School();
$school->comments = $_POST['comments'];
$school->pending = $_POST['pending'];
$school->enabled = $_POST['enabled'];
$school->name = $_POST['name'];
$school->address = $_POST['address'];
$school->email = $_POST['email'];
$school->number = $_POST['number'];
$school->about = $_POST['about'];
$school->create();
$schooluser = new SchoolUser();
$schooluser->pending = 0;
$schooluser->enabled = 1;
$schooluser->schoolid = $school->id;
$schooluser->userid = $session->user_id;
$schooluser->level = 1;
$schooluser->create();
$folder_path = "../../public/schools/";
mkdir($folder_path . $school->id . "/", 0700);
// schoolid folder
mkdir($folder_path . $school->id . "/yearbooks/", 0700);
// yearbook folder
$log = new Log($session->user_id, $clientip, "WEB", "CREATED SCHOOL: " . $_POST['id']);
$log->create();
} else {
示例8: _resetdb
function _resetdb()
{
if (!isset($_POST['dataOption'])) {
echo "error";
exit;
}
$dataOption = $_POST['dataOption'];
try {
$dbh = getdbh();
$list = explode(",", "v_leaderboard_main,v_ext_ranks,v_leaderboard_ext");
foreach ($list as $view) {
dropView($dbh, $view);
}
//
// rPI challenge data
//
$list = explode(",", "t_cts_data,t_fsl_data,t_hmb_data,t_cpa_data,t_ext_data");
foreach ($list as $table) {
dropTable($dbh, $table);
}
$list = explode(",", "t_event,t_user,t_rpi,t_station,t_stationtype,t_team,t_school");
foreach ($list as $table) {
dropTable($dbh, $table);
}
create_t_user($dbh);
create_t_stationtype($dbh);
create_t_station($dbh);
create_t_school($dbh);
create_t_team($dbh);
create_t_event($dbh);
create_t_rpi($dbh);
create_v_leaderboard_main($dbh);
create_v_ext_ranks($dbh);
create_v_leaderboard_ext($dbh);
//
// rPI challenge data
//
create_t_cts_data($dbh);
create_t_fsl_data($dbh);
create_t_hmb_data($dbh);
create_t_cpa_data($dbh);
create_t_ext_data($dbh);
$admin = new User();
$admin->set('username', "admin");
$admin->setPassword('pass');
$admin->set('email', "dcarreir@harris.com");
$admin->set('fullname', "administrator");
$admin->setRoll(USER::ROLL_ADMIN);
$admin->create();
$stationType = StationType::makeStationType(StationType::STATION_TYPE_REG, "Register", false, 60, "Hello! You have been successfully registered and may start the competition. Good luck!", "If you see this message there was an internal error 1", "If you see this message there was an internal error 2", "If you see this message there was an internal error 3");
if ($stationType === false) {
echo "Create StationType REG failed";
} else {
createStations(1, "reg", $stationType->get('OID'));
}
$stationType = StationType::makeStationType(StationType::STATION_TYPE_CTS, "Crack The Safe", true, 60, "Welcome, Team! Your first assignment is to break into Professor Aardvark's safe where you will find the first clue to his Secret Laboratory. Measure the interior angles and pick the three correct angles for the safe combination. Good luck! [clue=[clue]]", "Success! Go quickly to the next team queue.", "You have failed the challenge. Go quickly to the next team queue.", "No luck, better try again!");
$numStations = $dataOption == 1 ? 1 : 6;
if ($stationType === false) {
echo "Create StationType CTS failed";
} else {
createStations($numStations, "cts", $stationType->get('OID'));
}
$stationType = StationType::makeStationType(StationType::STATION_TYPE_FSL, "Find Secret Lab", false, 60, "Find and scan the [ordinal] at [waypoint-lat=[lat]] [waypoint-lon=[lng]].", "Success! Find and scan the [ordinal] marker at [waypoint-lat=[lat]] [waypoint-lon=[lng]].", "Too bad, you failed. Find and scan the [ordinal] marker at [waypoint-lat=[lat]] [waypoint-lon=[lng]].", "Wrong marker, try again!");
if ($stationType === false) {
echo "Create StationType FSL failed";
} else {
createStations(1, "fsl", $stationType->get('OID'));
}
$stationType = StationType::makeStationType(StationType::STATION_TYPE_HMB, "Defuse Hypermutation Bomb", true, 60, "The HMB has been triggered! Send the Energy Pulsator cycle time quickly!", "Success! Go quickly to the next team queue.", "Oops. Enough said. Go quickly to the next team queue.", "Nope, better try again!");
$numStations = $dataOption == 1 ? 1 : 6;
if ($stationType === false) {
echo "Create StationType HMB failed";
} else {
createStations($numStations, "hmb", $stationType->get('OID'));
}
$stationType = StationType::makeStationType(StationType::STATION_TYPE_CPA, "Catch Provessor Aardvark", true, 2000, "PA is trying to escape. Quickly measure the [fence=label] [building=[label]] and scan Start QR Code.", "Watch now as the professor attempts to escape. Get him!", "Success! Go quickly to the team finish area.", "Professor Aardvark has escaped. Oh well. Go quickly to the team finish area.", "Miss! Try again!");
$numStations = $dataOption == 1 ? 1 : 6;
if ($stationType === false) {
echo "Create StationType CPA failed";
} else {
createStations($numStations, "cpa", $stationType->get('OID'));
}
$stationType = StationType::makeStationType(StationType::STATION_TYPE_EXT, "Extra", false, 60, "You have 20 (TBR) minutes to provide the tower location and height. Good luck." . " [waypoint1-lat=[a_lat]] [waypoint1-lon=[a_lng]]" . " [waypoint2-lat=[b_lat]] [waypoint2-lon=[b_lng]]" . " [waypoint3-lat=[c_lat]] [waypoint3-lon=[c_lng]]", "Message received, return to base", "M didn't understand your message", "If you see this message there was an internal error 5");
if ($stationType === false) {
echo "Create StationType EXT failed";
} else {
createStations(1, "ext", $stationType->get('OID'));
}
if ($dataOption == 0) {
redirect('mgmt_main', 'Database Initialized without test data!');
return;
}
// generate test data
// for ($i=1;$i < 21; $i++) {
// $user = new User();
// $user->set('username','user'.$i);
// $user->setPassword('pass'.$i);
// $user->set('email','email'.$i."@harris.com");
// $user->set('fullname','User #'.$i);
// if ($user->create()===false) echo "Create user $i failed";
//.........这里部分代码省略.........
示例9: store
/**
* Store a newly created school in storage.
*
* @return Response
*/
public function store()
{
$validator = Validator::make($data = Input::all(), School::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
School::create($data);
return Redirect::route('schools.index');
}