當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Event::lookup方法代碼示例

本文整理匯總了PHP中app\models\Event::lookup方法的典型用法代碼示例。如果您正苦於以下問題:PHP Event::lookup方法的具體用法?PHP Event::lookup怎麽用?PHP Event::lookup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\models\Event的用法示例。


在下文中一共展示了Event::lookup方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: postNew

 /**
  * new-Action (Formularauswertung)
  */
 public function postNew()
 {
     $validator = Validator::make(Request::all(), Event::$rules);
     // validation has passed, write events in range on that date to xml File
     $geocoding_arr = Event::lookup(Request::input('adress'));
     $date = strtotime(Request::input('date'));
     (double) ($lat = $geocoding_arr['latitude']);
     (double) ($lng = $geocoding_arr['longitude']);
     //Start XML file, create parent node
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->startDocument('1.0', 'UTF-8');
     if ($validator->passes()) {
         // validation has passed, save event in DB
         $event = new Event();
         $event->title = Request::input('name');
         $event->content = Request::input('content');
         $event->link = Request::input('link');
         $event->type = Request::input('type');
         $event->latitude = $lat;
         $event->longitude = $lng;
         $event->save();
         return redirect('events')->with('message', 'success|Event erfolgreich angelegt!');
     } else {
         // validation has failed, display error messages
         return redirect('events/new')->with('message', 'danger|Die folgenden Fehler sind aufgetreten:')->withErrors($validator)->withInput();
     }
 }
開發者ID:HenOltma,項目名稱:EventMap,代碼行數:31,代碼來源:EventController.php

示例2: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $geocoding_arr = Event::lookup(Request::input('adress'));
     $date = strtotime(Request::input('date'));
     (double) ($lat = $geocoding_arr['latitude']);
     (double) ($lng = $geocoding_arr['longitude']);
     //
     $event = new Event();
     $event->title = Request::input('title');
     $event->content = Request::input('content');
     $event->link = Request::input('link');
     $event->type = Request::input('type');
     $event->latitude = $lat;
     $event->longitude = $lng;
     $event->save();
     $response = new \stdClass();
     $response->success = true;
     $response->total = 1;
     $response->data = $event;
     return response()->json($response);
 }
開發者ID:HenOltma,項目名稱:EventMap,代碼行數:27,代碼來源:EventRESTController.php


注:本文中的app\models\Event::lookup方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。