/**
* @param array $data
* @param int|null $id
*/
protected function savePost(array $data = [], $id = null)
{
// Image Handling
if (isset($data['image'])) {
$data['image'] = $this->buildImage($data['slug'], $data['image']);
}
// We create the Post
if ($id === null) {
$data['author_id'] = Auth::id();
$this->posts->create($data);
} else {
$this->posts->update($data, $id);
}
}