Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Tenzing
/
pdf-customizer
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
bb0c41be
authored
2016-04-29 14:28:30 -0400
by
Jeff Balicki
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
eee
1 parent
bb25ba4e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
app/Http/Controllers/FileEntryController.php
app/Http/routes.php
app/Http/Controllers/FileEntryController.php
View file @
bb0c41b
...
...
@@ -37,8 +37,7 @@ class FileEntryController extends Controller {
return
redirect
(
'fileentry'
);
}
public
function
get
(
$folder
,
$filename
){
public
function
getone
(
$folder
,
$filename
){
//$entry = Fileentry::where('filename', '=', $filename)->firstOrFail();
$file
=
Storage
::
disk
(
'public'
)
->
get
(
$folder
.
'/'
.
$filename
);
...
...
@@ -46,4 +45,12 @@ class FileEntryController extends Controller {
return
(
new
Response
(
$file
,
200
))
->
header
(
'Content-Type'
,
'image/jpeg'
);
}
public
function
get
(
$filename
){
$entry
=
Fileentry
::
where
(
'filename'
,
'='
,
$filename
)
->
firstOrFail
();
$file
=
Storage
::
disk
(
'local'
)
->
get
(
$entry
->
filename
);
return
(
new
Response
(
$file
,
200
))
->
header
(
'Content-Type'
,
$entry
->
mime
);
}
}
...
...
app/Http/routes.php
View file @
bb0c41b
...
...
@@ -30,8 +30,8 @@ Route::group(array('prefix' => 'api/v1'), function($json)
});
Route
::
get
(
'fileentry'
,
'FileEntryController@index'
);
Route
::
get
(
'fileentry/get/{folder}/{filename}'
,
[
Route
::
get
(
'fileentry/getone/{folder}/{filename}'
,
'FileEntryController@getone'
);
Route
::
get
(
'fileentry/get/{filename}'
,
[
'as'
=>
'getentry'
,
'uses'
=>
'FileEntryController@get'
]);
Route
::
post
(
'fileentry/add'
,[
'as'
=>
'addentry'
,
'uses'
=>
'FileEntryController@add'
]);
...
...
Please
register
or
sign in
to post a comment