public function postEdit($req)
 {
     $c = new Category();
     $c->fill($_POST);
     $c->id = $req->id;
     $result = $c->save();
     if ($result) {
         $this->service->flash('The category was edited.', 'success');
     } else {
         $this->service->flash('Can\'t edit the category.', 'alert');
     }
     return $this->service->back();
 }
 public function getById($id)
 {
     $pdo = Config::getInstance()->get('db.pdo');
     $stmt = $pdo->prepare('SELECT * FROM categories WHERE id = :id LIMIT 1');
     $result = $stmt->execute(['id' => $id]);
     if ($result) {
         $category = $stmt->fetch();
         $c = new Category();
         $c->fill($category);
         return $c;
     }
     return null;
 }