Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
2f3d1e5d
Commit
2f3d1e5d
authored
Oct 29, 2014
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding the update file
parent
5d353749
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
4 deletions
+38
-4
MediaController.php
Http/Controllers/Admin/MediaController.php
+9
-2
UpdateMediaRequest.php
Http/Requests/UpdateMediaRequest.php
+21
-0
EloquentFileRepository.php
Repositories/Eloquent/EloquentFileRepository.php
+8
-2
No files found.
Http/Controllers/Admin/MediaController.php
View file @
2f3d1e5d
<?php
namespace
Modules\Media\Http\Controllers\Admin
;
use
Illuminate\Support\Facades\Redirect
;
use
Illuminate\Support\Facades\View
;
use
Laracasts\Flash\Flash
;
use
Modules\Core\Http\Controllers\Admin\AdminBaseController
;
use
Modules\Media\Entities\File
;
use
Modules\Media\Http\Requests\UpdateMediaRequest
;
use
Modules\Media\Repositories\FileRepository
;
class
MediaController
extends
AdminBaseController
...
...
@@ -71,11 +74,15 @@ class MediaController extends AdminBaseController
* Update the specified resource in storage.
*
* @param File $file
* @param UpdateMediaRequest $request
* @return Response
*/
public
function
update
(
File
$file
)
public
function
update
(
File
$file
,
UpdateMediaRequest
$request
)
{
dd
(
'form posted'
);
$this
->
file
->
update
(
$file
,
$request
->
all
());
Flash
::
success
(
'File updated'
);
return
Redirect
::
route
(
'dashboard.media.index'
);
}
/**
...
...
Http/Requests/UpdateMediaRequest.php
0 → 100644
View file @
2f3d1e5d
<?php
namespace
Modules\Media\Http\Requests
;
use
Illuminate\Foundation\Http\FormRequest
;
class
UpdateMediaRequest
extends
FormRequest
{
public
function
rules
()
{
return
[];
}
public
function
authorize
()
{
return
true
;
}
public
function
messages
()
{
return
[];
}
}
Repositories/Eloquent/EloquentFileRepository.php
View file @
2f3d1e5d
<?php
namespace
Modules\Media\Repositories\Eloquent
;
use
Modules\Core\Internationalisation\Helper
;
use
Modules\Core\Repositories\Eloquent\EloquentBaseRepository
;
use
Modules\Media\Entities\File
;
use
Modules\Media\Helpers\FileHelper
;
use
Modules\Media\Repositories\FileRepository
;
use
Symfony\Component\HttpFoundation\File\UploadedFile
;
...
...
@@ -9,12 +11,16 @@ class EloquentFileRepository extends EloquentBaseRepository implements FileRepos
{
/**
* Update a resource
* @param
$id
* @param
File $file
* @param $data
* @return mixed
*/
public
function
update
(
$
id
,
$data
)
public
function
update
(
$
file
,
$data
)
{
$translatableData
=
Helper
::
separateLanguages
(
$data
);
Helper
::
updateTranslated
(
$file
,
$translatableData
);
return
$file
;
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment