本文整理汇总了PHP中Section::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Section::where方法的具体用法?PHP Section::where怎么用?PHP Section::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Section
的用法示例。
在下文中一共展示了Section::where方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printS
function printS($id)
{
$ci =& get_instance();
$s = new Section();
$s->get_by_id($id);
$s->e = anchor($ci->app->app_url('edit/') . $s->id, 'Edit');
$s->d = anchor($ci->app->app_url('delete/') . $s->id, 'Delete');
$output = "<li>";
$output .= $s->id . '|';
$output .= $s->name;
$output .= add($id, 0, "add first child for {$s->name}");
$output .= '|';
$output .= $s->e;
$output .= '|';
$output .= $s->d;
$c = new Section();
$c->where('parent_section', $id);
$c->order_by('sort', 'asc');
$c->get();
if (count($c->all) > 0) {
$output .= "<ul>";
foreach ($c->all as $item) {
$output .= printS($item->id);
$output .= "<li>" . add($id, $item->sort + 1) . "</li>";
}
$output .= "</ul>";
}
$output .= "</li>";
return $output;
}
示例2: delete
/**
* delete that section with all it's subsections
* plus eliminate the gap between it's siblings sort
**/
public function delete($object = '', $related_field = '')
{
if (empty($object)) {
// update all the sections sort after that section
// that in the same parent section
$s = new Section();
$s->where('sort >', $this->sort);
$s->where('parent_section', $this->parent_section);
$s->get();
foreach ($s as $item) {
$item->sort--;
$item->save();
}
}
//delete this section
parent::delete($object, $related_field);
}
示例3: update
/**
* Update the specified resource in storage.
* PUT /sections/{id}
*
* @param int $id
* @return Response
*/
public function update($id)
{
$section = Section::where('id', $id)->update(Input::all());
if ($section) {
$data = Section::find($id);
return ['status' => true, 'data' => $data];
} else {
return ['status' => false];
}
}
示例4: addaction
/**
* add section to system (the action page)
*
* @return void
*/
public function addaction()
{
$sort = new Section();
$sort->where('parent_section', $this->input->post('parent_section'))->select_max('sort')->get();
$sort = $sort->sort + 1;
$s = new Section();
$s->parent_section = $this->input->post('parent_section');
$s->name = $this->input->post('name');
$s->sort = $sort;
$s->view = $this->input->post('view');
$s->save();
redirect('section_editor');
}
示例5: foreach
//Cursor Component
//Count Cursor
$id = $purchase->id;
$docs = DB::table('document')->where('pr_id', '=', $id)->first();
$workflow = DB::table('workflow')->get();
$taskch = TaskDetails::where('doc_id', $docs->id)->where('status', 'New')->orWhere('status', 'Active')->count();
$taskexist = TaskDetails::where('doc_id', $docs->id)->count();
//Get Cursor Value
if ($taskch == 0) {
$taskc = TaskDetails::where('doc_id', $docs->id)->where('status', 'Done')->orderBy('id', 'DESC')->first();
} else {
$taskc = TaskDetails::where('doc_id', $docs->id)->where('status', 'New')->orWhere('status', 'Active')->first();
}
//Queries
$workflow = Workflow::find($docs->work_id);
$section = Section::where('workflow_id', $workflow->id)->orderBy('section_order_id', 'ASC')->get();
$taskd = TaskDetails::where('doc_id', $docs->id)->orderBy('id', 'ASC')->get();
$sectioncheck = 0;
$prdays = 0;
$lastid = 0;
if ($taskexist != 0) {
foreach ($section as $sections) {
$sectiondays = 0;
$task = Task::where('section_id', $sections->section_order_id)->where('wf_id', $workflow->id)->orderBy('order_id', 'ASC')->get();
echo "<div class='panel panel-success'><div class='panel-heading'><h3 class='panel-title'>" . $sections->section_order_id . ". " . $sections->sectionName . "</h3></div>";
echo "<div class='panel-body'>";
echo "<table border='1' class='workflow-table'>";
//Addon Display
$otherc = OtherDetails::where('section_id', $sections->id)->count();
if ($otherc != 0) {
$otherd = OtherDetails::where('section_id', $sections->id)->get();
示例6: duplicatecvpage
public function duplicatecvpage($cv_code)
{
$cv_old = Cv::where('cv_code', $cv_code)->first();
if ($cv_old->user_id != Auth::id()) {
return 'False';
}
$new_cv_name = $cv_old->cv_name . ' - Copy';
$cv = new Cv();
do {
$random = str_random(10);
$count = Cv::where('cv_code', $random)->count();
} while ($count != 0);
$cv->cv_code = $random;
if (Auth::check()) {
$cv->user_id = Auth::id();
}
$cv->cv_name = $new_cv_name;
$cv->user_id = $cv_old->user_id;
$cv->full_name = $cv_old->full_name;
$cv->phone_num = $cv_old->phone_num;
$cv->email = $cv_old->email;
$cv->website = $cv_old->website;
$cv->add_line1 = $cv_old->add_line1;
$cv->add_line2 = $cv_old->add_line2;
$cv->dob = $cv_old->dob;
$cv->marital_status = $cv_old->marital_status;
$cv->profile_image = $cv_old->profile_image;
$cv->sex = $cv_old->sex;
$cv->state_origin = $cv_old->state_origin;
$cv->religion = $cv_old->religion;
$cv->religion_text = $cv_old->religion_text;
$cv->show_profile_pic = $cv_old->show_profile_pic;
$cv->local_government = $cv_old->local_government;
$cv->save();
$new_cv_id = $cv->id;
// copying sections
$sections = Section::where('cv_id', $cv_old->id)->get();
foreach ($sections as $section) {
$section_new = new Section();
$section_new->cv_id = $new_cv_id;
$section_new->section_name = $section->section_name;
$section_new->type = $section->type;
$section_new->content = $section->content;
$section_new->default = $section->default;
$section_new->priority = $section->priority;
$section_new->save();
}
// copying educations
$educations = Education::where('cv_id', $cv_old->id)->get();
foreach ($educations as $education) {
$education_new = new Education();
$education_new->cv_id = $new_cv_id;
$education_new->coursename = $education->coursename;
$education_new->institutename = $education->institutename;
$education_new->add_line1 = $education->add_line1;
$education_new->add_line2 = $education->add_line2;
$education_new->startdate = $education->startdate;
$education_new->enddate = $education->enddate;
$education_new->otherinfo = $education->otherinfo;
$education_new->priority = $education->priority;
$education_new->save();
}
// copying languages
$languages = Language::where('cv_id', $cv_old->id)->get();
foreach ($languages as $language) {
$language_new = new Language();
$language_new->cv_id = $new_cv_id;
$language_new->language_id = $language->language_id;
$language_new->language_name = $language->language_name;
$language_new->ability_id = $language->ability_id;
$language_new->level_id = $language->level_id;
$language_new->priority = $language->priority;
$language_new->save();
}
// copying nysc
$nyscs = Nysc::where('cv_id', $cv_old->id)->get();
foreach ($nyscs as $nysc) {
$nysc_new = new Nysc();
$nysc_new->cv_id = $new_cv_id;
$nysc_new->year = $nysc->year;
$nysc_new->batch = $nysc->batch;
$nysc_new->ppa = $nysc->ppa;
$nysc_new->cd = $nysc->cd;
$nysc_new->otherinfo = $nysc->otherinfo;
$nysc_new->priority = $nysc->priority;
$nysc_new->save();
}
// copying work_exp
$work_exps = WorkExperience::where('cv_id', $cv_old->id)->get();
foreach ($work_exps as $work_exp) {
$work_exp_new = new WorkExperience();
$work_exp_new->cv_id = $new_cv_id;
$work_exp_new->title = $work_exp->title;
$work_exp_new->company = $work_exp->company;
$work_exp_new->location = $work_exp->location;
$work_exp_new->startdate = $work_exp->startdate;
$work_exp_new->enddate = $work_exp->enddate;
$work_exp_new->otherinfo = $work_exp->otherinfo;
$work_exp_new->priority = $work_exp->priority;
$work_exp_new->save();
//.........这里部分代码省略.........
示例7: Section
function deattach_section($section = '')
{
//=========================
//normalize the sort numbers
//=========================
$cont = new Section();
// we have to push all the content up to fill that hole
// these content must me in the same section,parent,cell
// and have sort nubmer greater than that content
$cont->where('parent_section', $section->parent_section);
//same section
$cont->where('sort >', $section->sort);
//greater sort
$cont->get();
//get them to process
foreach ($cont->all as $item) {
$item->sort--;
$item->save();
}
}
示例8: create_submit
public function create_submit()
{
//Image Upload
$users = DB::table('users')->get();
$purchasecheck = DB::table('purchase_request')->count();
if ($purchasecheck != 0) {
$purchase = Purchase::orderby('id', 'DESC')->first();
$docs = Document::orderby('id', 'DESC')->first();
$pr_id = $purchase->id + 1;
$doc_id = $docs->id + 1;
} else {
$pr_id = 1;
$doc_id = 1;
}
foreach (Input::file('file') as $file) {
$rules = array('file' => 'required|mimes:png,gif,jpeg,jpg|max:900000000000000000000');
$validator = \Validator::make(array('file' => $file), $rules);
$destine = public_path() . "/uploads";
if ($validator->passes()) {
$ext = $file->guessClientExtension();
// (Based on mime type)
$ext = $file->getClientOriginalExtension();
// (Based on filename)
$filename = $file->getClientOriginalName();
$archivo = value(function () use($file) {
$filename = str_random(10) . '.' . $file->getClientOriginalExtension();
return strtolower($filename);
});
$archivo = value(function () use($file) {
$date = date('m-d-Y-h-i-s', time());
$filename = $date . "-" . $file->getClientOriginalName();
return strtolower($filename);
});
$attach = new Attachments();
$attach->doc_id = $doc_id;
$attach->data = $archivo;
$attach->save();
$filename = $doc_id . "_" . $attach->id;
$file->move($destine, $archivo);
$target_folder = $destine;
$upload_image = $target_folder . "/" . $archivo;
$thumbnail = $target_folder . "/resize" . $archivo;
$actual = $target_folder . "/" . $archivo;
// THUMBNAIL SIZE
list($width, $height) = getimagesize($upload_image);
$newwidth = $width;
$newheight = $height;
while ($newheight > 525) {
$newheight = $newheight * 0.8;
$newwidth = $newwidth * 0.8;
}
$source = $upload_image;
$ext = strtolower($ext);
$thumb = imagecreatetruecolor($newwidth, $newheight);
if ($ext == "jpg" || $ext == "jpeg") {
$source = imagecreatefromjpeg($upload_image);
} elseif ($ext == "png") {
$source = imagecreatefrompng($upload_image);
} elseif ($ext == "gif") {
$source = imagecreatefromgif($upload_image);
} else {
continue;
}
// RESIZE
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
// MAKE NEW FILES
if ($ext == "jpg" || $ext == "jpeg") {
imagejpeg($thumb, $thumbnail, 100);
} elseif ($ext == "png") {
imagepng($thumb, $thumbnail, 9);
} elseif ($ext == "gif") {
imagegif($thumb, $thumbnail, 100);
} else {
echo "An invalid image";
}
unlink($actual);
// FILE RENAMES
rename($thumbnail, $actual);
} else {
$errors = $validator->errors();
Session::put('imgerror', 'Invalid file.');
}
}
//End Image Upload
$purchase = new Purchase();
$document = new Document();
$purchase->projectPurpose = strip_tags(Input::get('projectPurpose'));
$purchase->sourceOfFund = strip_tags(Input::get('sourceOfFund'));
$purchase->amount = Input::get('amount');
$purchase->office = Input::get('office');
$purchase->requisitioner = Input::get('requisitioner');
if (!Input::get('dateRequested') == '') {
$purchase->dateRequested = Input::get('dateRequested');
}
$purchase->dateReceived = Input::get('dateReceived');
$purchase->status = 'Active';
$purchase->otherType = Input::get('otherType');
// Get latest control number
$cn = Input::get('controlNo');
$checkUniqueControlNo = Purchase::where('controlNo', '=', "{$cn}")->count();
//.........这里部分代码省略.........
示例9: janisawesome
public function janisawesome()
{
function generateRandomString($length = 10)
{
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, strlen($characters) - 1)];
}
return $randomString;
}
function generateRandomAmount()
{
$length = rand(4, 8);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= rand(1, 9);
}
return $randomString;
}
$numLoop = 1;
while ($numLoop < 301) {
$purchase = new Purchase();
$document = new Document();
$purchase->projectPurpose = generateRandomString();
$purchase->sourceOfFund = generateRandomString();
$controlAmt = generateRandomAmount();
$controlAmt .= ".00";
$purchase->amount = number_format($controlAmt);
$purchase->office = "1";
$purchase->requisitioner = "1";
$purchase->dateRequested = date('Y-m-d H:i:s');
$purchase->dateReceived = date('Y-m-d H:i:s');
$purchase->status = 'Active';
$purchase->otherType = " ";
// Get latest control number
$cn = 0;
$purchase_controlNo = Purchase::orderBy('ControlNo', 'DESC')->first();
if (!$purchase_controlNo == NuLL) {
$cn = $purchase_controlNo->controlNo;
}
$cn += 1;
$purchase->controlNo = $cn;
if (Input::get('otherType') == ' ') {
$purchase->projectType = "None";
} else {
$purchase->projectType = "None";
}
// Set creator id
$user_id = Auth::user()->id;
$purchase->created_by = $user_id;
$purchase_save = $purchase->save();
if ($purchase_save) {
if ($controlAmt < 50000) {
$amtControl = 1;
} else {
if ($controlAmt >= 50000 && $controlAmt <= 500000) {
$amtControl = 2;
} else {
if ($controlAmt >= 500000) {
$amtControl = 3;
}
}
}
$document->pr_id = $purchase->id;
$document->work_id = $amtControl;
$document_save = $document->save();
if ($document_save) {
$doc_id = $document->id;
$workflow = Workflow::find($document->work_id);
$section = Section::where('workflow_id', $document->work_id)->orderBy('section_order_id', 'ASC')->get();
$firstnew = 0;
// Set due date;
$new_purchase = Purchase::find($purchase->id);
$workflow_id = "1";
$workflow = Workflow::find($workflow_id);
$addToDate = $workflow->totalDays;
date_default_timezone_set("Asia/Manila");
$dueDate = date('Y-m-d H:i:s', strtotime("+{$addToDate} days"));
$new_purchase->dueDate = $dueDate;
$new_purchase->save();
$tasks = Task::where('wf_id', $document->work_id)->orderBy('section_id', 'ASC')->orderBy('order_id', 'ASC')->get();
foreach ($tasks as $task) {
$task_details = new TaskDetails();
$task_details->task_id = $task->id;
$stringamount = $new_purchase->amount;
$stringamount = str_replace(str_split(','), '', $stringamount);
$amount = (double) $stringamount;
if ($firstnew == 0) {
$task_details->status = "New";
} else {
$task_details->status = "Pending";
}
//Project Type
if ($task->taskName == "PRE-PROCUREMENT CONFERENCE" || $task->taskName == "ADVERTISEMENT" || $task->taskName == "PRE-BID CONFERENCE") {
$task_details->status = "Lock";
if ($new_purchase->projectType == "Goods/Services") {
if ($task->taskName == "PRE-PROCUREMENT CONFERENCE" || $task->taskName == "ADVERTISEMENT") {
if ($amount > 2000000) {
$task_details->status = "Pending";
//.........这里部分代码省略.........
示例10: deleteSection
public function deleteSection($section_id, $code)
{
$cv = Cv::where('cv_code', $code)->first();
$cv_id = $cv->id;
Section::where('id', $section_id)->where('cv_id', $cv_id)->delete();
$data["success"] = 1;
$data["message"] = "Succefully deleted";
return json_encode($data);
}