Adding an update file route

parent 42e2979a
......@@ -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
......
......@@ -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',
]);
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment