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


PHP Page::find方法代碼示例

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


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

示例1: togglePublish

 /**
  * @param $id
  *
  * @return mixed
  */
 public function togglePublish($id)
 {
     $page = $this->page->find($id);
     $page->is_published = $page->is_published ? false : true;
     $page->save();
     return Response::json(array('result' => 'success', 'changed' => $page->is_published ? 1 : 0));
 }
開發者ID:noikiy,項目名稱:fullycms,代碼行數:12,代碼來源:PageRepository.php

示例2: action_update

 public function action_update($id)
 {
     $post_page = Input::get('postpage') ? 1 : 0;
     $page = Page::where('page_name', '=', str_replace('-', '', Input::get('sub')))->first();
     $order = Page::order_by('created_at', 'desc')->first();
     $level = Input::get('subpage') ? $page->level + 1 : 0;
     $parent = Input::get('subpage') ? $page->slug : 'none';
     $slug = $this->slugger(Input::get('title'));
     $oldpage = Page::find($id);
     $oldpage->page_name = Input::get('title');
     $oldpage->page_content = Input::get('content');
     $oldpage->level = $level;
     $oldpage->parent = $parent;
     $oldpage->post_page = $post_page;
     $success = $oldpage->save();
     if (Input::get('subpage')) {
         $p = Page::where('page_name', '=', str_replace('-', '', Input::get('sub')))->first();
         $p->has_child = '1';
         $p->save();
     }
     if (!$success) {
         Log::write('/admin/pages/:id/edit', 'could not update page - $oldpage->save returned false');
         return Redirect::to("admin/pages/{$oldpage->id}/edit")->with('error_update', 'page could not be updated');
     }
     return Redirect::to("admin/pages/{$oldpage->id}/edit")->with('status_update', 'page updated');
 }
開發者ID:ryankennedy1991,項目名稱:Toure-cms,代碼行數:26,代碼來源:pages.php

示例3: createComponentPageEditForm

 protected function createComponentPageEditForm($name)
 {
     $form = $this->createPageFormBase($name, false);
     if (!$form->isSubmitted()) {
         $id = $this->getParam("id");
         $page = Page::find($id);
         $values = $page->getValues();
         $values["tags"] = $page->Tags->fetchColumn("id");
         $form->setDefaults($values);
     }
     $presenter = $this;
     $form->onSubmit[] = function ($form) use($presenter) {
         $values = $form->values;
         try {
             $page = Page::create($values);
             $page->Tags = array_map(function ($id) {
                 return Tag::create($id);
             }, $values["tags"]);
             $page->save();
             $presenter->flashMessage("Page '{$page->name}' was changed!");
             $presenter->redirect("default", array("id" => $page->id));
         } catch (ModelException $e) {
             $page->addErrorsToForm($form);
         }
     };
 }
開發者ID:janmarek,項目名稱:Ormion,代碼行數:26,代碼來源:PagePresenter.php

示例4: destroy

 public function destroy($id)
 {
     $page = Page::find($id);
     //$page->delete();
     Notification::success('The page was deleted.');
     return Redirect::route('admin.pages.index');
 }
開發者ID:brucewu16899,項目名稱:laravel-admin-panel,代碼行數:7,代碼來源:PlayerController.php

示例5: index

 public function index()
 {
     $page = Page::find(1);
     $menuItems = Page::where('parent_id', 0)->get();
     $news = News::with('user')->orderBy('created_at', 'desc')->first();
     return View::make('front.pages.index')->with(['page' => $page, 'news' => $news, 'menuitems' => $menuItems]);
 }
開發者ID:stefferd,項目名稱:schwachofer,代碼行數:7,代碼來源:FrontController.php

示例6: test_delete

 public function test_delete()
 {
     $pageService = new PageService(666);
     $page = $pageService->save(true, ['en_US' => new PageLangDTO('Name US', 'Content US', 'SEO Title US', 'SEO Description US', 'handle-us')]);
     $this->DELETE("/666/pages/{$page->id}");
     $page = Page::find($page->id);
     $this->assertNotNull($page->deleted_at);
 }
開發者ID:jknox12,項目名稱:mirror,代碼行數:8,代碼來源:RoutesTest.php

示例7: view

 function view()
 {
     if (isset($_REQUEST['id'])) {
         $page = new Page();
         $this->columns = $page->_columns;
         $this->page = $page->find($_REQUEST['id']);
     }
 }
開發者ID:jimeh,項目名稱:zynapse,代碼行數:8,代碼來源:page_controller.php

示例8: findOnPage

 /**
  * Retrieves the given $url and returns the first match for the nonce regex or false if not found.
  * 
  * @param \Requests_Session $session The session to send the request from.
  * @param string $url The page URL.
  * @param string $regex The regex to use to find the nonce. It must have a single capture group.
  * 
  * @return string|false The nonce if found, otherwise false.
  */
 public static function findOnPage(\Requests_Session $session, $url, $regex = '/name="_wpnonce"\\s+value="(.+?)"/')
 {
     //TODO: improve this to be more than just a dumb regex match
     $nonceMatches = Page::find($session, $url, $regex);
     if (!is_array($nonceMatches) || count($nonceMatches) < 2 || empty($nonceMatches[1])) {
         return false;
     }
     return $nonceMatches[1];
 }
開發者ID:wordfence,項目名稱:exkit,代碼行數:18,代碼來源:WPNonce.php

示例9: listPagesUrl

 public static function listPagesUrl()
 {
     $model = Page::find()->asArray()->all();
     $pages = [];
     foreach ($model as $page) {
         $pages[$page['url']] = $page['name'];
     }
     return $pages;
 }
開發者ID:phucnv206,項目名稱:pharma,代碼行數:9,代碼來源:Page.php

示例10: get_page

 public function get_page($page_id)
 {
     if ($page = Page::find($page_id)) {
         if (Auth::check()) {
             History::add_page($page_id);
         }
         return view('content.page')->with('page', $page);
     }
     return Response::error('404');
 }
開發者ID:bankorh,項目名稱:ecom1_laravel,代碼行數:10,代碼來源:content.php

示例11: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($url_seo)
 {
     $page = DB::table('banners')->where('url_seo', '=', $url_seo)->first();
     $id = $page->id;
     $page = Page::find($id);
     $page->visitas++;
     $page->save();
     // show the view and pass the nerd to it
     return View::make('pages.show', array('page' => $page));
 }
開發者ID:keloxers,項目名稱:Cooperativa,代碼行數:16,代碼來源:BannersController.php

示例12: showDetails

 public function showDetails($id)
 {
     $page = Page::find($id);
     // If no item in database
     if (empty($page) || empty($page->id)) {
         return Redirect::route('home')->with('message', Lang::get('pages.inexistant'));
     }
     $this->layout->content = View::make('public.pages.details');
     $this->layout->content->page = $page;
     $this->layout->content_title = $page->title;
 }
開發者ID:ddcint,項目名稱:benefund,代碼行數:11,代碼來源:PagesController.php

示例13: find

 /**
  * Scoped finder for page versions
  *
  * @param page page object or page_id as number
  * @return array of page objects or null
  */
 public static function find($args = null)
 {
     if (is_array($args)) {
         if (array_key_exists('where', $args) and !empty($args['where'])) {
             $args['where'] .= ' and (behavior_id="version" or behavior_id="current_version")';
         } else {
             $args['where'] = '(behavior_id="version" or behavior_id="current_version")';
         }
     }
     return parent::find($args);
 }
開發者ID:julpi,項目名稱:freshcms_page_versions,代碼行數:17,代碼來源:PageVersion.php

示例14: getPageList

 /**
  * ページリストを取得する
  * 
  * @param string $categoryId
  * @return mixed boolean / array
  * @access public
  */
 function getPageList($categoryId = null)
 {
     if ($this->Page) {
         $conditions = array('Page.status' => 1);
         if ($categoryId) {
             $conditions['Page.page_category_id'] = $categoryId;
         }
         $this->Page->unbindModel(array('belongsTo' => array('PageCategory')));
         $pages = $this->Page->find('all', array('conditions' => $conditions, 'fields' => array('title', 'url'), 'order' => 'Page.sort'));
         return Set::extract('/Page/.', $pages);
     } else {
         return false;
     }
 }
開發者ID:ryuring,項目名稱:basercms,代碼行數:21,代碼來源:bc_baser.php

示例15: minus

 /**
  * @param $postId
  * @param \User $author
  * @return bool|void
  */
 public static function minus($postId, \User $author)
 {
     $page = \Page::find(intval($postId));
     if (!$page) {
         return false;
     }
     if ($page->author_id == $author->id) {
         return $page->author_id;
     }
     if ($page->author->rate(-1)) {
         return $page->author_id;
     }
     return false;
 }
開發者ID:Max201,項目名稱:nanocore,代碼行數:19,代碼來源:Page.php


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