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


PHP Entry::find方法代码示例

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


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

示例1: destroy

 /**
  * Remove the specified resource from storage.
  * DELETE /entries/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $entry = Entry::find($id);
     $entry->delete();
     return Redirect::route('entries.index');
 }
开发者ID:JustinMackenzie,项目名称:meal-log,代码行数:13,代码来源:EntriesController.php

示例2: deleteEntryAction

 public function deleteEntryAction()
 {
     $entry = Entry::find(Route::input('id'));
     $entry->delete();
     return Redirect::route('blog/list');
 }
开发者ID:shiccocsan,项目名称:laravel_simple_blog,代码行数:6,代码来源:BlogController.php

示例3: getEntry

 private function getEntry()
 {
     $entry_id = $this->getEntryIdFromSession();
     if ($entry_id > 0) {
         $entry = Entry::find($entry_id);
         if ($entry) {
             return $entry;
         } else {
             $this->removeEntryIdFromSession();
         }
     }
     return NULL;
 }
开发者ID:ajwgibson,项目名称:rugby-world-cup-laravel,代码行数:13,代码来源:EntryController.php

示例4: localize

 public function localize($file_id)
 {
     $contentClient = new \Guzzle\Service\Client('http://' . Config::get('app.content_host') . '/');
     $entry = Entry::find($file_id);
     if ($entry->is_dir) {
         return ['success' => false, 'error_message' => 'Cannot compute SHA1 of directory'];
     }
     $this->authenticate($entry->dropbox_id);
     $tmpfname = tempnam(sys_get_temp_dir(), $file_id);
     $fd = fopen($tmpfname, "w+");
     $meta = $this->active_client->getFile($entry->original_path, $fd);
     $sha1 = sha1_file($tmpfname);
     if (strrpos(basename($entry->original_path), '.')) {
         $extension = substr(basename($entry->original_path), strrpos(basename($entry->original_path), '.'));
     } else {
         $extension = ".extensionless";
     }
     $save_path = 'dropbox/' . $sha1 . $extension;
     // check the byte size of the cached file if it exists on the content server
     $request = $contentClient->head($save_path);
     try {
         $response = $request->send();
         $contentLength = $response->getContentLength();
     } catch (Guzzle\Http\Exception\BadResponseException $e) {
         $clientResponseException = $e->getResponse();
         $statusCode = $clientResponseException->getStatusCode();
         if ($statusCode !== 404) {
             return ['success' => false, 'error_message' => 'HEAD request from content server path ' . $save_path . ' raised http exception ' . $statusCode . "\n" . print_r($clientResponseException, true)];
         }
         $contentLength = false;
     }
     // Raise an exception if we are about to localize this file in place of another file with the same content SHA
     if ($contentLength && $contentLength > 0 && $contentLength != filesize($tmpfname)) {
         return ['success' => false, 'error_message' => "File exists on content server with same SHA but different byte count!"];
     }
     // Upload the file if it does not already exist on the content server
     if (!$contentLength) {
         $request = $contentClient->put($save_path);
         $request->getCurlOptions()->set(CURLOPT_SSL_VERIFYHOST, false);
         // for testing ONLY!
         $request->getCurlOptions()->set(CURLOPT_SSL_VERIFYPEER, false);
         // for testing ONLY!
         // TODO: Determine which approach is best of these two:
         // Having a second pointer on same file, while first pointer is still open
         // (Temp files are deleted as soon as fclose called)
         $request->setBody(fopen($tmpfname, 'r'));
         // Or should we use....
         // rewind($fd);
         // $request->setBody($fd);
         // I'm not sure if guzzle would support that,
         // nor if w+ mode supports rewind
         // (Will it read from start without erasing after a rewind in w+?)
         $response = $request->send();
     }
     // Close the temp file pointer
     fclose($fd);
     // Update the database with the file size information
     $entry->file_sha = $sha1;
     $entry->etag = sha1($sha1 . $entry->bytes . $entry->service_updated_at . $entry->client_updated_at);
     $entry->save();
     // TODO: Error handling
     // TODO: Process abstraction from controller to classes
     return ['success' => true, 'local_url' => 'http://' . Config::get('app.content_host') . '/' . $save_path];
 }
开发者ID:andrewpurkett,项目名称:demo-dropbox-rest-service,代码行数:64,代码来源:DropboxCrawlerController.php

示例5: destroy

 /**
  * Remove the specified resource from storage.
  * DELETE /entries/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $entry = Entry::find($id);
     Entry::destroy($id);
     return Redirect::route('users.show', [$entry->author->slug]);
 }
开发者ID:judavi,项目名称:laravel-challenge,代码行数:13,代码来源:EntriesController.php

示例6: voteDown

 public function voteDown($id)
 {
     $userToken = $this->getUserToken();
     $voter = User::where('token', '=', $userToken)->first();
     $entry = Entry::find($id);
     if ($voter && $entry) {
         $vote = $entry->voteDown($voter);
         $vote->notifyAuthor();
         return Redirect::route('entries.showAsVoter', [$id]);
     } else {
         App::abort(404);
     }
 }
开发者ID:CreativeMons,项目名称:creative-city,代码行数:13,代码来源:EntryController.php

示例7: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $entry = Entry::find($id);
     return View::make('entries.show', compact('entry'));
 }
开发者ID:andrewpurkett,项目名称:demo-dropbox-rest-service,代码行数:11,代码来源:EntriesController.php

示例8: checkEntries

 public function checkEntries($data)
 {
     $values = array_values($data);
     if (!isset($values)) {
         return false;
     }
     $value = $values[0];
     $startdate = dateToSql($this->data['Setting']['fy_start']);
     $enddate = dateToSql($value);
     /* Load the Ledger model */
     App::import("Webzash.Model", "Entry");
     $Entry = new Entry();
     $count = $Entry->find('count', array('conditions' => array('OR' => array('Entry.date <' => $startdate, 'Entry.date >' => $enddate))));
     if ($count != 0) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:lognaume,项目名称:webzash,代码行数:19,代码来源:Setting.php


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