mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Document behind route
This commit is contained in:
parent
74450727b1
commit
06413da090
@ -78,7 +78,7 @@ class DocumentController extends BaseController
|
||||
return $this->itemResponse($document);
|
||||
}
|
||||
|
||||
public function download(DownloadDocumentRequest $request, Document $document)
|
||||
public function download(ShowDocumentRequest $request, Document $document)
|
||||
{
|
||||
return response()->streamDownload(function () use($document) {
|
||||
echo file_get_contents($document->generateUrl());
|
||||
@ -93,7 +93,7 @@ class DocumentController extends BaseController
|
||||
*/
|
||||
public function edit(EditDocumentRegquest $request, Document $document)
|
||||
{
|
||||
//
|
||||
return $this->itemResponse($document);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -105,7 +105,7 @@ class DocumentController extends BaseController
|
||||
*/
|
||||
public function update(UpdateDocumentRequest $request, Document $document)
|
||||
{
|
||||
//
|
||||
return $this->itemResponse($document);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -115,9 +115,7 @@ class Document extends BaseModel
|
||||
|
||||
public function generateRoute($absolute = false)
|
||||
{
|
||||
return route('api.documents.show', ['document' => $this->hashed_id]);
|
||||
|
||||
//return route('document.show', ['document' => $this->hashed_id]);
|
||||
return route('api.documents.show', ['document' => $this->hashed_id]) . '/download';
|
||||
}
|
||||
|
||||
public function deleteFile()
|
||||
|
@ -35,8 +35,16 @@ class DocumentRepository extends BaseRepository
|
||||
$document->forceDelete();
|
||||
}
|
||||
|
||||
public function restore()
|
||||
public function restore($document)
|
||||
{
|
||||
if (! $document->trashed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$document->restore();
|
||||
|
||||
if (class_exists($className)) {
|
||||
event(new $className($document));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a
|
||||
Route::post('vendors/bulk', 'VendorController@bulk')->name('vendors.bulk');
|
||||
|
||||
Route::resource('documents', 'DocumentController');// name = (documents. index / create / show / update / destroy / edit
|
||||
|
||||
Route::get('documents/{document}/download', 'DocumentController@download')->name('documents.download');
|
||||
Route::post('documents/bulk', 'DocumentController@bulk')->name('documents.bulk');
|
||||
|
||||
Route::resource('client_statement', 'ClientStatementController@statement');// name = (client_statement. index / create / show / update / destroy / edit
|
||||
|
Loading…
Reference in New Issue
Block a user