当前位置: 首页>>代码示例>>PHP>>正文


PHP Fields::where方法代码示例

本文整理汇总了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();
     }
 }
开发者ID:tomven1990,项目名称:faveo-helpdesk,代码行数:59,代码来源:TicketController.php


注:本文中的Fields::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。