示例#1
0
 public function getPostCountAttribute()
 {
     return Post::where('category_id', $this->id)->count();
 }
示例#2
0
文件: Posts.php 项目: zrosiak/fields
 /**
  * zmiana nadrzędnej kategorii
  * @param int $parmam id posta
  */
 public function onChangeTemplate($param = null)
 {
     if (isset($param) && empty(post('Post')['template_id']) === false) {
         $post = Post::where('id', (int) $param)->first();
         $post->template_id = (int) post('Post')['template_id'];
         $post->save();
         return Redirect::to('backend/bm/field/posts/update/' . $param);
     }
 }