public function getPostCountAttribute() { return Post::where('category_id', $this->id)->count(); }
/** * 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); } }