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


PHP Item::active方法代码示例

本文整理汇总了PHP中app\Item::active方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::active方法的具体用法?PHP Item::active怎么用?PHP Item::active使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Item的用法示例。


在下文中一共展示了Item::active方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $res['status'] = 400;
     $res['message'] = '';
     $res['errors'] = [];
     // $input = $request->only('firstname_quote', 'lastname_quote', 'email_quote', 'phone_quote', 'date_quote', 'time_quote', 'passengers', 'pickup_addr', 'pickup_building', 'pickup_floors', 'pickup_room_no', 'pickup_elevator', 'delivery_addr', 'delivery_building', 'delivery_floors', 'delivery_room_no' , 'delivery_elevator');
     $input = $request->all();
     $data = $input;
     $rules = ['service_type' => 'required|max:150', 'name_quote' => 'required|max:150', 'email_quote' => 'required|email', 'phone_quote' => 'required', 'date_quote' => 'required|max:20', 'passengers' => 'numeric', 'pickup_addr' => 'required|max:255', 'pickup_building' => 'max:255', 'pickup_floors' => 'max:255', 'pickup_room_no' => 'max:255', 'pickup_elevator' => 'max:3', 'delivery_addr' => 'required|max:255', 'delivery_building' => 'max:255', 'delivery_floors' => 'max:255', 'delivery_room_no' => 'max:255', 'delivery_elevator' => 'max:3', 'message_quote' => 'max:1000'];
     $this->validate($request, $rules);
     $items = Item::active()->orderBy('number_in_row')->get();
     foreach ($items as $item) {
         if (!isset($input[$item->id . '___quantity'])) {
             $res['message'] = 'An error occour, please refresh page and try again.';
             return response()->json($res);
         }
         $data['selected_items'][$item->id]['title'] = $item->title;
         $data['selected_items'][$item->id]['image'] = $item->image;
         $data['selected_items'][$item->id]['quantity'] = (int) $input[$item->id . '___quantity'];
     }
     $res['data'] = $data;
     $res['status'] = 200;
     Mail::send('emails.quotation', $res, function ($m) use($data) {
         $m->to(Config::get('constants.admin')['email'], Config::get('constants.admin')['name'])->subject($data['name_quote'] . ' has filled a quotation for you.');
     });
     return response()->json($res);
 }
开发者ID:sherazali123,项目名称:removals-laravel,代码行数:32,代码来源:QuatationController.php


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