mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Quicklink fiscal year report feature. As per github issue #131.
The reason for instantiating the helper at the beginning of the static function routeBinder is I am hoping that the object will only be created once.
This commit is contained in:
@@ -11,6 +11,7 @@ namespace FireflyIII\Support\Binder;
|
||||
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Helpers\FiscalHelper;
|
||||
use Exception;
|
||||
use Log;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
@@ -32,6 +33,8 @@ class Date implements BinderInterface
|
||||
*/
|
||||
public static function routeBinder($value, $route)
|
||||
{
|
||||
$fiscalHelper = new FiscalHelper;
|
||||
|
||||
switch ($value) {
|
||||
default:
|
||||
try {
|
||||
@@ -50,6 +53,10 @@ class Date implements BinderInterface
|
||||
return Carbon::now()->startOfYear();
|
||||
case 'currentYearEnd':
|
||||
return Carbon::now()->endOfYear();
|
||||
case 'currentFiscalYearStart':
|
||||
return $fiscalHelper->startOfFiscalYear(Carbon::now());
|
||||
case 'currentFiscalYearEnd':
|
||||
return $fiscalHelper->endOfFiscalYear(Carbon::now());
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user