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
2dd4056b
Unverified
Commit
2dd4056b
authored
Sep 30, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create a dedicated dropzone store uri
parent
5c60947c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
1 deletion
+43
-1
MediaController.php
Modules/Media/Http/Controllers/Api/MediaController.php
+16
-0
UploadDropzoneMediaRequest.php
Modules/Media/Http/Requests/UploadDropzoneMediaRequest.php
+21
-0
apiRoutes.php
Modules/Media/Http/apiRoutes.php
+5
-0
asgard-globals.blade.php
Themes/Adminlte/views/partials/asgard-globals.blade.php
+1
-1
No files found.
Modules/Media/Http/Controllers/Api/MediaController.php
View file @
2dd4056b
...
...
@@ -11,6 +11,7 @@ use Modules\Media\Events\FileWasLinked;
use
Modules\Media\Events\FileWasUnlinked
;
use
Modules\Media\Events\FileWasUploaded
;
use
Modules\Media\Helpers\FileHelper
;
use
Modules\Media\Http\Requests\UploadDropzoneMediaRequest
;
use
Modules\Media\Http\Requests\UploadMediaRequest
;
use
Modules\Media\Image\Imagy
;
use
Modules\Media\Repositories\FileRepository
;
...
...
@@ -113,6 +114,21 @@ class MediaController extends Controller
return
response
()
->
json
(
$savedFile
->
toArray
());
}
public
function
storeDropzone
(
UploadDropzoneMediaRequest
$request
)
:
JsonResponse
{
$savedFile
=
$this
->
fileService
->
store
(
$request
->
file
(
'file'
));
if
(
is_string
(
$savedFile
))
{
return
response
()
->
json
([
'error'
=>
$savedFile
,
],
409
);
}
event
(
new
FileWasUploaded
(
$savedFile
));
return
response
()
->
json
(
$savedFile
->
toArray
());
}
public
function
update
(
File
$file
,
Request
$request
)
{
$data
=
$request
->
except
([
'filename'
,
'path'
,
'extension'
,
'size'
,
'id'
,
'thumbnails'
]);
...
...
Modules/Media/Http/Requests/UploadDropzoneMediaRequest.php
0 → 100644
View file @
2dd4056b
<?php
namespace
Modules\Media\Http\Requests
;
use
Illuminate\Foundation\Http\FormRequest
;
use
Modules\Media\Validators\MaxFolderSizeRule
;
class
UploadDropzoneMediaRequest
extends
FormRequest
{
public
function
rules
()
{
return
[
'file'
=>
[
'required'
,
new
MaxFolderSizeRule
()],
];
}
public
function
authorize
()
{
return
true
;
}
}
Modules/Media/Http/apiRoutes.php
View file @
2dd4056b
...
...
@@ -29,6 +29,11 @@ $router->group(['middleware' => 'api.token'], function (Router $router) {
'as'
=>
'api.media.store'
,
'middleware'
=>
'token-can:media.medias.create'
,
]);
$router
->
post
(
'file-dropzone'
,
[
'uses'
=>
'MediaController@storeDropzone'
,
'as'
=>
'api.media.store-dropzone'
,
'middleware'
=>
'token-can:media.medias.create'
,
]);
$router
->
post
(
'media/link'
,
[
'uses'
=>
'MediaController@linkMedia'
,
'as'
=>
'api.media.link'
,
...
...
Themes/Adminlte/views/partials/asgard-globals.blade.php
View file @
2dd4056b
...
...
@@ -3,7 +3,7 @@
backendUrl
:
'
{{ config(
'
asgard
.
core
.
core
.
admin
-
prefix
'
) }}
'
,
mediaGridCkEditor
:
'
{{ route(
'
media
.
grid
.
ckeditor
'
) }}
'
,
mediaGridSelectUrl
:
'
{{ route(
'
media
.
grid
.
select
'
) }}
'
,
dropzonePostUrl
:
'
{{ route(
'
api
.
media
.
store
'
) }}
'
,
dropzonePostUrl
:
'
{{ route(
'
api
.
media
.
store
-
dropzone
'
) }}
'
,
mediaSortUrl
:
'
{{ route(
'
api
.
media
.
sort
'
) }}
'
,
mediaLinkUrl
:
'
{{ route(
'
api
.
media
.
link
'
) }}
'
,
mediaUnlinkUrl
:
'
{{ route(
'
api
.
media
.
unlink
'
) }}
'
...
...
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