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
c58bdbdc
Commit
c58bdbdc
authored
Oct 29, 2014
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding removing file option
parent
fc3f4e11
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
6 deletions
+34
-6
MediaController.php
Http/Controllers/Admin/MediaController.php
+7
-3
MediaServiceProvider.php
Providers/MediaServiceProvider.php
+2
-2
EloquentFileRepository.php
Repositories/Eloquent/EloquentFileRepository.php
+1
-1
index.blade.php
Resources/views/admin/index.blade.php
+24
-0
No files found.
Http/Controllers/Admin/MediaController.php
View file @
c58bdbdc
...
...
@@ -88,11 +88,15 @@ class MediaController extends AdminBaseController
/**
* Remove the specified resource from storage.
*
* @param int $id
* @param File $file
* @internal param int $id
* @return Response
*/
public
function
destroy
(
$id
)
public
function
destroy
(
File
$file
)
{
//
$this
->
file
->
destroy
(
$file
);
Flash
::
success
(
'File deleted'
);
return
Redirect
::
route
(
'dashboard.media.index'
);
}
}
Providers/MediaServiceProvider.php
View file @
c58bdbdc
...
...
@@ -40,8 +40,8 @@ class MediaServiceProvider extends ServiceProvider
{
$this
->
app
->
bind
(
'Modules\Media\Repositories\FileRepository'
,
function
()
{
return
new
EloquentFileRepository
(
new
File
);
function
(
$app
)
{
return
new
EloquentFileRepository
(
new
File
,
$app
[
'filesystem.disk'
]
);
}
);
}
...
...
Repositories/Eloquent/EloquentFileRepository.php
View file @
c58bdbdc
...
...
@@ -57,7 +57,7 @@ class EloquentFileRepository extends EloquentBaseRepository implements FileRepos
public
function
destroy
(
$file
)
{
$this
->
finder
->
delete
(
public_path
()
.
$file
->
path
);
$this
->
finder
->
delete
(
'public/'
.
$file
->
path
);
$file
->
delete
();
}
...
...
Resources/views/admin/index.blade.php
View file @
c58bdbdc
...
...
@@ -78,6 +78,30 @@
</div>
</div>
</div>
<?php
if
(
$files
)
:
?>
<?php
foreach
(
$files
as
$file
)
:
?>
<!-- Modal -->
<div
class=
"modal fade"
id=
"confirmation-{{ $file->id }}"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"myModalLabel"
aria-hidden=
"true"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
><span
aria-hidden=
"true"
>
×
</span><span
class=
"sr-only"
>
Close
</span></button>
<h4
class=
"modal-title"
id=
"myModalLabel"
>
{{ trans('core::core.modal.title') }}
</h4>
</div>
<div
class=
"modal-body"
>
{{ trans('core::core.modal.confirmation-message') }}
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
{{ trans('core::core.button.cancel') }}
</button>
{!! Form::open(['route' => ['dashboard.media.destroy', $file->id], 'method' => 'delete', 'class' => 'pull-left']) !!}
<button
type=
"submit"
class=
"btn btn-danger btn-flat"
><i
class=
"glyphicon glyphicon-trash"
></i>
{{ trans('core::core.button.delete') }}
</button>
{!! Form::close() !!}
</div>
</div>
</div>
</div>
<?php
endforeach
;
?>
<?php
endif
;
?>
@stop
@section('scripts')
...
...
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