Basic attachment download function.

This commit is contained in:
James Cole
2015-07-18 21:32:31 +02:00
parent 359fab315f
commit cc1af60cb4
6 changed files with 115 additions and 2 deletions

View File

@@ -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
*/