本文整理匯總了PHP中Fields::where方法的典型用法代碼示例。如果您正苦於以下問題:PHP Fields::where方法的具體用法?PHP Fields::where怎麽用?PHP Fields::where使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Fields
的用法示例。
在下文中一共展示了Fields::where方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: create_ticket
/**
* Create Ticket
* @param type $user_id
* @param type $subject
* @param type $body
* @param type $helptopic
* @param type $sla
* @param type $priority
* @return type string
*/
public function create_ticket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $attach = '')
{
try {
$max_number = Tickets::whereRaw('id = (select max(`id`) from tickets)')->first();
if ($max_number == null) {
$ticket_number = "AAAA-9999-9999999";
} else {
foreach ($max_number as $number) {
$ticket_number = $max_number->ticket_number;
}
}
$ticket = new Tickets();
$ticket->ticket_number = $this->ticket_number($ticket_number);
$ticket->user_id = $user_id;
$ticket->dept_id = $dept;
$ticket->help_topic_id = $helptopic;
$ticket->sla = $sla;
$ticket->assigned_to = $assignto;
$ticket->status = '1';
$ticket->priority_id = $priority;
$ticket->source = $source;
$ticket->save();
$ticket_number = $ticket->ticket_number;
$id = $ticket->id;
if ($form_data != null) {
$help_topic = Help_topic::where('id', '=', $helptopic)->first();
$forms = Fields::where('forms_id', '=', $help_topic->custom_form)->get();
foreach ($form_data as $key => $form_details) {
foreach ($forms as $from) {
if ($from->name == $key) {
$form_value = new Ticket_Form_Data();
$form_value->ticket_id = $id;
$form_value->title = $from->label;
$form_value->content = $form_details;
$form_value->save();
}
}
}
}
$this->store_collaborators($headers, $id);
$thread = $this->ticket_thread($subject, $body, $id, $user_id);
if (!empty($attach)) {
$this->attach($thread, $attach);
}
return $thread;
} catch (\Exception $e) {
return $e->getMessage();
}
}