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:
Graham Miller
2016-01-29 09:11:36 +10:00
parent 3d69dc786d
commit 41188a1bd6
3 changed files with 16 additions and 0 deletions

View File

@@ -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());
}
}