itskp-odense/Backend/controller/upload.php

21 lines
423 B
PHP
Raw Normal View History

<?php
//require our bootstrap file for database connection
require "../../bootstrap.php";
use Backend\Model\Post;
2021-06-04 10:34:47 +00:00
//Create a new initialize
$post = new Post();
2021-06-04 10:34:47 +00:00
//Get the data from post and save it to the post model
$post->title = $_POST['title'];
$post->description = $_POST['description'];
2021-06-04 10:34:47 +00:00
//Call the save function.
if(!$post->save()){
return http_response_code(400);
}else{
return http_response_code(200);
}
2021-06-04 10:34:47 +00:00