e
Showing
4 changed files
with
51 additions
and
19 deletions
| ... | @@ -95,6 +95,22 @@ class ApiController extends Controller | ... | @@ -95,6 +95,22 @@ class ApiController extends Controller |
| 95 | 95 | ||
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | public function update($json) | ||
| 99 | { | ||
| 100 | $apiCallId = new pdfModel(); | ||
| 101 | $apiCallId = $apiCallId->addApiCall('1',$json); | ||
| 102 | //$apiCallId = "3"; | ||
| 103 | $pdfId = new pdfModel(); | ||
| 104 | $pdfId = $pdfId->addPdf($apiCallId, $json); | ||
| 105 | $pdf = new PdfController(); | ||
| 106 | $pdf = $pdf->pdf($pdfId); | ||
| 107 | $response = $pdf; | ||
| 108 | $statusCode = 200; | ||
| 109 | return Response::json($response, $statusCode); | ||
| 110 | |||
| 111 | |||
| 112 | } | ||
| 113 | |||
| 98 | 114 | ||
| 99 | 115 | ||
| 100 | public function getList($json) | 116 | public function getList($json) |
| ... | @@ -109,12 +125,15 @@ class ApiController extends Controller | ... | @@ -109,12 +125,15 @@ class ApiController extends Controller |
| 109 | 125 | ||
| 110 | public function getApi($json) | 126 | public function getApi($json) |
| 111 | { | 127 | { |
| 112 | $statusCode = 200; | 128 | $file = Storage::disk('public')->get('interface.js'); |
| 113 | $response = include('js/interface.js'); | 129 | return $file; |
| 114 | return Response::json($response, $statusCode); | ||
| 115 | 130 | ||
| 131 | return (new Response($file, 200)) | ||
| 132 | ->header('Content-Type', 'text/html'); | ||
| 116 | } | 133 | } |
| 117 | 134 | ||
| 135 | |||
| 136 | |||
| 118 | public function getPdf($json) | 137 | public function getPdf($json) |
| 119 | { | 138 | { |
| 120 | $rows = new pdfModel(); | 139 | $rows = new pdfModel(); |
| ... | @@ -125,11 +144,6 @@ class ApiController extends Controller | ... | @@ -125,11 +144,6 @@ class ApiController extends Controller |
| 125 | 144 | ||
| 126 | } | 145 | } |
| 127 | 146 | ||
| 128 | public function view(File $file) | 147 | |
| 129 | { | ||
| 130 | $response = new BinaryFileResponse($file->getAbsolutePath()); | ||
| 131 | $response->headers->set('Content-Disposition', 'inline; filename="' . $file->real_filename . '"'); | ||
| 132 | return $response; | ||
| 133 | } | ||
| 134 | 148 | ||
| 135 | } | 149 | } | ... | ... |
| ... | @@ -45,6 +45,7 @@ class FileEntryController extends Controller { | ... | @@ -45,6 +45,7 @@ class FileEntryController extends Controller { |
| 45 | return (new Response($file, 200)) | 45 | return (new Response($file, 200)) |
| 46 | ->header('Content-Type', 'image/jpeg'); | 46 | ->header('Content-Type', 'image/jpeg'); |
| 47 | } | 47 | } |
| 48 | |||
| 48 | public function get($filename){ | 49 | public function get($filename){ |
| 49 | 50 | ||
| 50 | $entry = Fileentry::where('filename', '=', $filename)->firstOrFail(); | 51 | $entry = Fileentry::where('filename', '=', $filename)->firstOrFail(); |
| ... | @@ -53,4 +54,13 @@ class FileEntryController extends Controller { | ... | @@ -53,4 +54,13 @@ class FileEntryController extends Controller { |
| 53 | return (new Response($file, 200)) | 54 | return (new Response($file, 200)) |
| 54 | ->header('Content-Type', $entry->mime); | 55 | ->header('Content-Type', $entry->mime); |
| 55 | } | 56 | } |
| 57 | |||
| 58 | public function getApi($json) | ||
| 59 | { | ||
| 60 | $file = Storage::disk('public')->get('js/interface.js'); | ||
| 61 | |||
| 62 | return (new Response($file, 200)) | ||
| 63 | ->header('Content-Type', 'text/html'); | ||
| 64 | } | ||
| 65 | |||
| 56 | } | 66 | } | ... | ... |
| ... | @@ -34,7 +34,7 @@ class PdfController extends Controller | ... | @@ -34,7 +34,7 @@ class PdfController extends Controller |
| 34 | $outfile=""; | 34 | $outfile=""; |
| 35 | $title = "Test Pages"; | 35 | $title = "Test Pages"; |
| 36 | $storagePath = Storage::disk('local')->getDriver()->getAdapter()->getPathPrefix(); | 36 | $storagePath = Storage::disk('local')->getDriver()->getAdapter()->getPathPrefix(); |
| 37 | // $outfile = $storagePath.$searchpath."/new_".$rows[0]->file; | 37 | $outfile = $storagePath.$searchpath."/new_".$rows[0]->file; |
| 38 | 38 | ||
| 39 | try { | 39 | try { |
| 40 | 40 | ||
| ... | @@ -152,15 +152,17 @@ try { | ... | @@ -152,15 +152,17 @@ try { |
| 152 | $p->end_document(""); | 152 | $p->end_document(""); |
| 153 | 153 | ||
| 154 | 154 | ||
| 155 | return $outfile; | ||
| 156 | |||
| 155 | /// To turn on pdf screen out put uncomment below lines and remove the text in $output="" Var | 157 | /// To turn on pdf screen out put uncomment below lines and remove the text in $output="" Var |
| 156 | 158 | ||
| 157 | $buf = $p->get_buffer(); | 159 | //$buf = $p->get_buffer(); |
| 158 | $len = strlen($buf); | 160 | //$len = strlen($buf); |
| 159 | 161 | ||
| 160 | header("Content-type: application/pdf"); | 162 | //header("Content-type: application/pdf"); |
| 161 | header("Content-Length: $len"); | 163 | //header("Content-Length: $len"); |
| 162 | header("Content-Disposition: inline; filename=test_pages.pdf"); | 164 | //header("Content-Disposition: inline; filename=test_pages.pdf"); |
| 163 | print $buf; | 165 | //print $buf; |
| 164 | 166 | ||
| 165 | 167 | ||
| 166 | 168 | ... | ... |
| ... | @@ -23,15 +23,21 @@ Route::group(array('prefix' => 'api/v1'), function($json) | ... | @@ -23,15 +23,21 @@ Route::group(array('prefix' => 'api/v1'), function($json) |
| 23 | { | 23 | { |
| 24 | 24 | ||
| 25 | Route::resource('add', 'ApiController@insert'); | 25 | Route::resource('add', 'ApiController@insert'); |
| 26 | Route::resource('update', 'ApiController@update'); | ||
| 26 | Route::resource('get-list', 'ApiController@getList'); | 27 | Route::resource('get-list', 'ApiController@getList'); |
| 27 | Route::resource('get-pdf', 'ApiController@getpdf'); | 28 | Route::resource('get-pdf', 'ApiController@getpdf'); |
| 28 | Route::resource('api', 'ApiController@getApi'); | 29 | Route::resource('api', 'FileEntryController@getApi'); |
| 29 | 30 | ||
| 30 | }); | 31 | }); |
| 31 | 32 | ||
| 32 | Route::get('fileentry', 'FileEntryController@index'); | 33 | Route::get('api/v1/update', 'ApiController@getpdf'); |
| 33 | Route::get('fileentry/getone/{folder}/{filename}', 'FileEntryController@getone'); | 34 | |
| 34 | Route::get('fileentry/get/{filename}', [ | 35 | Route::get('fileentry/get/{filename}', [ |
| 35 | 'as' => 'getentry', 'uses' => 'FileEntryController@get']); | 36 | 'as' => 'getentry', 'uses' => 'FileEntryController@get']); |
| 37 | |||
| 38 | |||
| 39 | Route::get('fileentry', 'FileEntryController@index'); | ||
| 40 | Route::get('fileentry/getone/{folder}/{filename}', 'FileEntryController@getone'); | ||
| 41 | |||
| 36 | Route::post('fileentry/add',[ | 42 | Route::post('fileentry/add',[ |
| 37 | 'as' => 'addentry', 'uses' => 'FileEntryController@add']); | 43 | 'as' => 'addentry', 'uses' => 'FileEntryController@add']); | ... | ... |
-
Please register or sign in to post a comment