当前位置: 首页>>代码示例>>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;未经允许,请勿转载。