Example #1
0
 public function input($moe)
 {
     $post = Post::instance()->findByPK($moe->get('GET.id'))->findById_author(Auth::data('id_author'))->get(1);
     if ($moe->isPost()) {
         $post->copyfrom('POST');
         $post->id_author = Auth::data('id_author');
         !$post->save() || $moe->reroute('@manage_post');
         $moe->set('message', 'Data gagal disimpan!');
         !$post->hasMessage() || $moe->concat('message', '<br>' . $post->asList('messages'));
     } else {
         $post->copyto('POST');
     }
     $moe->set('categoryList', Category::instance()->optionList());
     $moe->send('admin/post_input');
 }
Example #2
0
 public function delete($moe)
 {
     $moe->send(array('result' => Category::instance()->findByPK($moe->get('GET.id'))->get(1)->delete()));
 }