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


PHP Blog::find方法代码示例

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


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

示例1: view

 public function view($query)
 {
     $blog = new Blog();
     $params = array('blog' => $blog->find($query[0]));
     $this->setParams('params', $params);
     $this->render();
 }
开发者ID:gitter-badger,项目名称:Mist-1,代码行数:7,代码来源:BlogController.php

示例2: index

 public function index()
 {
     $Blog = new Blog($this->table_name, $this->action);
     $sql = $Blog->find('all');
     $blogs = mysqli_query($this->db, $sql) or die(mysqli_error($this->db));
     return $blogs;
 }
开发者ID:amico8,项目名称:seed_framework,代码行数:7,代码来源:blogs_controller.php

示例3: post

 /**
  * Add a new post
  *
  * @param Request $request
  * @param string $params
  * @return void
  */
 protected static function post($request, $params)
 {
     static::authorize($request);
     try {
         $data = array('categoryID' => $request->get('categoryID'), 'blogID' => Blog::find(array('id' => $request->user->id))->get('id'), 'title' => $request->get('title'), 'content' => $request->get('content'), 'created' => time());
         $post = new Post($data);
         static::response($post->save(), 201, '');
     } catch (Exception $e) {
         static::response(array(), 400, $e->getMessage());
     }
 }
开发者ID:anehx,项目名称:blog,代码行数:18,代码来源:PostListController.class.php

示例4: update

 public function update($id)
 {
     $blog = Blog::find($id);
     if (FEUsersHelper::isCurrentUser($blog->user->id)) {
         $blog->title = Input::get('title');
         $blog->content = Input::get('content');
         $blog->privacy = Input::get('privacy');
         $blog->save();
         FEEntriesHelper::updatePrivacy($blog->id, 2, $blog->privacy);
         return Redirect::back();
     } else {
         return Redirect::to('/');
     }
 }
开发者ID:huuson94,项目名称:WebProject,代码行数:14,代码来源:FEBlogsController.php

示例5: put

 /**
  * Update a blog
  *
  * @param Request $request
  * @param string $params
  * @return void
  */
 protected static function put($request, $params)
 {
     static::authorize($request);
     try {
         $blog = Blog::find(array('id' => $params));
         if ($blog->userID === $request->user->id) {
             $blog->set('name', $request->get('blogname'));
             static::response($blog->save(), 200, '');
         } else {
             static::response(array(), 403, 'No Permission');
         }
     } catch (Exception $e) {
         static::response(array(), 400, $e->getMessage());
     }
 }
开发者ID:anehx,项目名称:blog,代码行数:22,代码来源:BlogController.class.php

示例6: post

 /**
  * Log a user in
  *
  * @param Request $request
  * @param string $params
  * @return void
  */
 protected static function post($request, $params)
 {
     try {
         $user = User::find(array('username' => $request->get('username')));
         if (!is_a($user, 'User')) {
             static::response(array(), 400, 'No user found');
         } elseif (password_verify($request->get('password'), $user->get('password'))) {
             $user->blog = Blog::find(array('userID' => $user->id));
             static::response($user, 200);
         } else {
             static::response(array(), 400, 'Wrong password');
         }
     } catch (Exception $e) {
         static::response(array(), 500, $e->getMessage());
     }
 }
开发者ID:anehx,项目名称:blog,代码行数:23,代码来源:LoginController.class.php

示例7: index

 public function index()
 {
     if (!empty($this->request->data['Admin']['icon'])) {
         $this->_saveFavicon();
     }
     if (!empty($this->request->data['Admin']['export'])) {
         $this->SiteExport->_exportSite($this->request->data['Admin']['export']);
     }
     if (!empty($this->request->data['Upgrade']['all'])) {
         $this->SiteUpdate->_runUpdates();
         $this->set('runUpdates', true);
     }
     if (!empty($this->request->data['Update']['index'])) {
         $this->view = 'index_upgrade';
     }
     if (!empty($this->request->data['Alias']['update'])) {
         App::uses('Alias', 'Model');
         $Alias = new Alias();
         $this->set('syncd', $Alias->sync());
         $this->view = 'index_upgrade';
     }
     $complete = $this->Session->read('Updates.complete');
     if (!empty($complete)) {
         $this->Session->delete('Updates');
         $this->Session->setFlash(__('Update check complete!!!'), 'flash_success');
     }
     $this->set('title_for_layout', 'Admin Dashboard');
     $this->set('page_title_for_layout', 'Admin Dashboard');
     $this->layout = 'default';
     // this is here so we can show "Add Post" links foreach Blog on the dashboard
     if (CakePlugin::loaded('Blogs')) {
         App::uses('Blog', 'Blogs.Model');
         $Blog = new Blog();
         $this->set('blogs', $Blog->find('all'));
     }
 }
开发者ID:ayaou,项目名称:Zuha,代码行数:36,代码来源:AdminController.php

示例8: indexAction

 public function indexAction()
 {
     // view all blog posts
     $blog = new Blog($this->_db);
     $this->_template->posts = $blog->find();
 }
开发者ID:bamcod,项目名称:PubCodeHub,代码行数:6,代码来源:indexController.php

示例9: hide_blog

 public function hide_blog($id)
 {
     $blog = Blog::find($id);
     $blog->is_published = 0;
     $blog->save();
     return Redirect::to('/blogs')->with('message', $blog->topic . 'is successfully hidden');
 }
开发者ID:shankargiri,项目名称:taylor_latest,代码行数:7,代码来源:BlogsController.php

示例10: view

 public function view($id)
 {
     // get our post, identified by the route
     // parameter
     $blog = Blog::find($id);
     $blog->views += 1;
     $blog->save();
     // show the full view, and pass the post
     // we just aquired
     return View::make('blog.view')->with('blog', $blog);
 }
开发者ID:shinichi81,项目名称:laravel4demo,代码行数:11,代码来源:BlogController.php

示例11: deleteAction

 public function deleteAction()
 {
     // make sure they own it
     $Blog = new Blog($this->_db, new User($this->_db, $_SESSION['user']['id']));
     $post = $Blog->find(array('id' => abs($_GET['id'])));
     if (empty($post[0]) || $post[0]['users_id'] != $_SESSION['user']['id']) {
         $this->_template->hud = array('class' => 'error', 'message' => 'You do not own this post!');
         return false;
     }
     if ($Blog->destroy($_GET['id'])) {
         $this->forward('index', array('class' => 'success', 'message' => 'The post was removed!'));
     } else {
         $this->_template->hud = array('class' => 'error', 'message' => 'There was a problem removing the post!');
     }
 }
开发者ID:bamcod,项目名称:PubCodeHub,代码行数:15,代码来源:manageController.php

示例12: destroy

 /**
  * Remove the specified resource from storage.
  *
  * DELETE /{id}
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $res = Blog::find($id)->delete();
     $text = $res ? 'Запись удалена' : 'Запись не удалена';
     session()->flash('global', $text);
     return redirect('/blog');
 }
开发者ID:avil13,项目名称:cross-fit.loc,代码行数:14,代码来源:GroupController.php

示例13: mostrarPost

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function mostrarPost($id)
 {
     $bannersizquierda = Banner::where('seccion', '=', 'BLOG-IZQUIERDA')->where('habilitar', '=', '1')->orderBy('id', 'asc')->get();
     $bannersderecha = Banner::where('seccion', '=', 'BLOG-DERECHA')->where('habilitar', '=', '1')->orderBy('id', 'asc')->get();
     $bannersindexarriba = Banner::where('seccion', '=', 'INDEX-ARRIBA')->where('habilitar', '=', 1)->orderBy('id', 'asc')->get();
     $anuncios = Anuncio::all();
     $rolusuarioLogueado = '';
     $mailusuarioLogueado = '';
     $nombreusuarioLogueado = '';
     if (Auth::check()) {
         $authuser = Auth::user();
         $usu = Usuario::find($authuser->id);
         $mailusuarioLogueado = $authuser->email;
         $nombreusuarioLogueado = $authuser->nombre;
         $rolusuarioLogueado = DB::table('usuario_tiene_rol2')->where('usuario_id', '=', $authuser->id)->first();
         $rolusuarioLogueado = UsuarioRol::find($rolusuarioLogueado->rol_id)->rol;
     }
     $post = Blog::find($id);
     return View::make('index.blogPost')->with(array('bannersizquierda' => $bannersizquierda, 'bannersderecha' => $bannersderecha, 'post' => $post, 'anuncios' => $anuncios, 'username' => $mailusuarioLogueado, 'nameuser' => $nombreusuarioLogueado, 'roluser' => $rolusuarioLogueado, 'bannersindexarriba' => $bannersindexarriba));
     //
 }
开发者ID:ubx-caloca,项目名称:todoconstruimos,代码行数:27,代码来源:blogController.php

示例14: doDelete

 /**
  * Form for POST doDelete the specified resource.
  *
  * @return Response
  */
 public function doDelete()
 {
     $aData = Input::all();
     if (isset($aData['id'])) {
         $blog = Blog::find($aData['id']);
         $blog->delete();
         return Redirect::route('blog-list')->with('message', 'Блог успешно удален');
     }
     return Redirect::route('blog-list')->with('message', 'Произошла ошибка удаления');
 }
开发者ID:sergey-donchenko,项目名称:hr-agency,代码行数:15,代码来源:BlogController.php


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