FEATURE: add possibilityy to upload and assign files to content pages
This commit is contained in:
@@ -87,6 +87,9 @@ class EditContent extends Controller
|
||||
public function postEdit(EditContentRequest $request, $id)
|
||||
{
|
||||
try {
|
||||
/**
|
||||
* @var $page Content
|
||||
*/
|
||||
$page = Content::findOrFail($id);
|
||||
} catch (NotFoundHttpException $e) {
|
||||
|
||||
@@ -104,11 +107,7 @@ class EditContent extends Controller
|
||||
$request->titlePhotoFilename = $page->title_photo;
|
||||
|
||||
// upload file - if provided
|
||||
if ($request->hasFile('titlePhoto')) {
|
||||
$file = $this->file->upload($request->file('titlePhoto'), $request);
|
||||
|
||||
$request->titlePhotoFilename = $file['filename'];
|
||||
}
|
||||
$page->uploadTitlePhoto($request);
|
||||
|
||||
// array of fields in database and fields from request
|
||||
$fields = [
|
||||
@@ -130,6 +129,7 @@ class EditContent extends Controller
|
||||
list($revision, $changedColumns) = $page->updateWithHistory($fields, $data);
|
||||
|
||||
$changedColumns += call_user_func_array([$page->module_handler, 'edit'], [&$page, $request, $revision]);
|
||||
$changedColumns += $page->uploadRelatedFiles($request, $revision);
|
||||
|
||||
// was something changed?
|
||||
if ($changedColumns == 0) {
|
||||
|
||||
Reference in New Issue
Block a user