itskp-odense/Backend/controller/upload.php

19 lines
460 B
PHP

<?php
//require our bootstrap file for database connection
require "../../bootstrap.php";
use Backend\Model\Post;
if(isset($_POST['title'])){
//Create a new initialize
$post = new Post();
//Get the data from post and save it to the post model
$post->title = $_POST['title'];
$post->description = $_POST['description'];
//Call the save function.
if($post->save())
echo json_encode(array($post->id, $post->created_at));
}