mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Basic attachment download function.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\Attachment;
|
||||
use FireflyIII\Models\Bill;
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Models\Category;
|
||||
@@ -42,6 +43,19 @@ Route::bind(
|
||||
}
|
||||
);
|
||||
|
||||
Route::bind(
|
||||
'attachment', function ($value) {
|
||||
if (Auth::check()) {
|
||||
$object = Attachment::where('id', $value)->where('user_id', Auth::user()->id)->first();
|
||||
if ($object) {
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
|
||||
throw new NotFoundHttpException;
|
||||
}
|
||||
);
|
||||
|
||||
Route::bind(
|
||||
'currency', function ($value) {
|
||||
if (Auth::check()) {
|
||||
@@ -177,6 +191,12 @@ Route::group(
|
||||
Route::post('/accounts/update/{account}', ['uses' => 'AccountController@update', 'as' => 'accounts.update']);
|
||||
Route::post('/accounts/destroy/{account}', ['uses' => 'AccountController@destroy', 'as' => 'accounts.destroy']);
|
||||
|
||||
/**
|
||||
* Attachment Controller
|
||||
*/
|
||||
Route::get('/attachment/{attachment}/download', ['uses' => 'AttachmentController@download', 'as' => 'attachment.download']);
|
||||
|
||||
|
||||
/**
|
||||
* Bills Controller
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user