src/Controller/ArticleController.php
public function CreateAction()
  {
    // Checks if the form has been completed
    if (!empty($_POST))
    {
      // Uploads the image & gets back the file name
      $data['image'] = $this->upload('img/blog');

      // Creates the $data array to store the new article
      $data['title']        = $_POST['title'];
      $data['link']         = $_POST['link'];
      $data['content']      = $_POST['content'];
      $data['created_date'] = $_POST['date'];
      $data['updated_date'] = $_POST['date'];

      // Creates the article
      ModelFactory::get('Article')->create($data);

      // Creates a valid message to confirm the creation of a new article
      htmlspecialchars(Session::createAlert('New article created successfully !', 'valid'));

      // Redirects to the admin
      $this->redirect('admin');
    }
    else {
      // Returns the rendering of the view createArticle with the empty fields
      return $this->render('admin/createArticle.twig');
    }
  }
public function CreateAction()
  {
    // Checks if the form has been completed
    if (!empty($_POST))
    {
      // Uploads the image & gets back the file name
      $data['image'] = $this->upload('img/blog');

      // Creates the $data array to store the new article
      $data['title']        = $_POST['title'];
      $data['link']         = $_POST['link'];
      $data['content']      = $_POST['content'];
      $data['created_date'] = $_POST['date'];
      $data['updated_date'] = $_POST['date'];

      // Creates the article
      ModelFactory::get('Article')->create($data);

      // Creates a valid message to confirm the creation of a new article
      htmlspecialchars(Session::createAlert('New article created successfully !', 'valid'));

      // Redirects to the admin
      $this->redirect('admin');
    }
    else {
      // Returns the rendering of the view createArticle with the empty fields
      return $this->render('admin/createArticle.twig');
    }
  }
*******************\
Creates a new article
@return mixed => the rendering of the view createArticle