本文整理汇总了PHP中Purchase::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Purchase::orderBy方法的具体用法?PHP Purchase::orderBy怎么用?PHP Purchase::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Purchase
的用法示例。
在下文中一共展示了Purchase::orderBy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<input name="doc_id" type="hidden" value="{{ $doc_id }}">
<br>
<br>
{{ Form::close() }}
@if(Session::get('imgsuccess'))
<div class="alert alert-success"> {{ Session::get('imgsuccess') }}</div>
@endif
@if(Session::get('imgerror'))
<div class="alert alert-danger"> {{ Session::get('imgerror') }}</div>
@endif
<?php
$id = 0;
$purchase = Purchase::orderBy('id', 'ASC')->get();
?>
<?php
error_reporting(0);
$attachmentc = DB::table('attachments')->where('doc_id', $doc_id)->count();
if ($attachmentc != 0) {
$attachments = DB::table('attachments')->where('doc_id', $doc_id)->get();
}
$srclink = "uploads\\";
?>
<br>
<table>
示例2: array
</select>
</div>
<div class="col-md-3">
{{ Form::label('otherType', 'Other Type', array('class' => 'create-label')) }}
@if($purchaseToEdit->otherType == ' ' || $purchaseToEdit->otherType == null)
<input type="text" disabled value="None" class="form-control">
@else
<input type="text" disabled value="{{ $purchaseToEdit->otherType }}" class="form-control">
@endif
</div>
<div class="col-md-3">
<?php
$cn = 0;
$purchase = Purchase::orderBy('controlNo', 'ASC')->get();
foreach ($purchase as $pur) {
$cn = (int) $pur->controlNo;
}
$cn = $cn + 1;
?>
{{ Form::label('dispCN', 'Control No.', array('class' => 'create-label')) }}
<input type="text" name="dispCN" class="form-control" value="<?php
echo str_pad($purchaseToEdit->controlNo, 5, '0', STR_PAD_LEFT);
?>
"disabled>
<input type="hidden" name="controlNo" value="{{
$purchaseToEdit->controlNo}}">
</div>
</div>
示例3: 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";
//.........这里部分代码省略.........