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
10f1f624
Unverified
Commit
10f1f624
authored
Sep 23, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding an update file route
parent
42e2979a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
MediaController.php
Modules/Media/Http/Controllers/Api/MediaController.php
+12
-0
apiRoutes.php
Modules/Media/Http/apiRoutes.php
+5
-0
No files found.
Modules/Media/Http/Controllers/Api/MediaController.php
View file @
10f1f624
...
...
@@ -109,6 +109,18 @@ class MediaController extends Controller
return
response
()
->
json
(
$savedFile
->
toArray
());
}
public
function
update
(
File
$file
,
Request
$request
)
{
$data
=
$request
->
except
([
'filename'
,
'path'
,
'extension'
,
'size'
,
'id'
,
'thumbnails'
]);
$this
->
file
->
update
(
$file
,
$data
);
return
response
()
->
json
([
'errors'
=>
false
,
'message'
=>
trans
(
'media::messages.file updated'
),
]);
}
/**
* Link the given entity with a media file
* @param Request $request
...
...
Modules/Media/Http/apiRoutes.php
View file @
10f1f624
...
...
@@ -55,4 +55,9 @@ $router->group(['middleware' => 'api.token'], function (Router $router) {
'uses'
=>
'MediaController@find'
,
'as'
=>
'api.media.media.find'
,
]);
$router
->
put
(
'file/{file}'
,
[
'uses'
=>
'MediaController@update'
,
'as'
=>
'api.media.media.update'
,
'middleware'
=>
'token-can:media.medias.edit'
,
]);
});
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