Some code cleanup [skip ci]

This commit is contained in:
James Cole 2015-05-26 12:08:46 +02:00
parent 349e077802
commit 3af0dd2e3b
5 changed files with 18 additions and 31 deletions

View File

@ -53,7 +53,7 @@ class ReportHelper implements ReportHelperInterface
* @param Carbon $end * @param Carbon $end
* @param $shared * @param $shared
* *
* @return Account * @return AccountCollection
*/ */
public function getAccountReport(Carbon $date, Carbon $end, $shared) public function getAccountReport(Carbon $date, Carbon $end, $shared)
{ {

View File

@ -3,10 +3,11 @@
namespace FireflyIII\Helpers\Report; namespace FireflyIII\Helpers\Report;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Helpers\Collection\Account; use FireflyIII\Helpers\Collection\Account as AccountCollection;
use FireflyIII\Helpers\Collection\Balance; use FireflyIII\Helpers\Collection\Balance;
use FireflyIII\Helpers\Collection\Budget as BudgetCollection; use FireflyIII\Helpers\Collection\Budget as BudgetCollection;
use FireflyIII\Helpers\Collection\Category as CategoryCollection; use FireflyIII\Helpers\Collection\Category as CategoryCollection;
use FireflyIII\Helpers\Collection\Bill as BillCollection;
use FireflyIII\Helpers\Collection\Expense; use FireflyIII\Helpers\Collection\Expense;
use FireflyIII\Helpers\Collection\Income; use FireflyIII\Helpers\Collection\Income;
@ -26,7 +27,7 @@ interface ReportHelperInterface
* @param Carbon $end * @param Carbon $end
* @param boolean $shared * @param boolean $shared
* *
* @return Account * @return AccountCollection
*/ */
public function getAccountReport(Carbon $date, Carbon $end, $shared); public function getAccountReport(Carbon $date, Carbon $end, $shared);
@ -38,7 +39,7 @@ interface ReportHelperInterface
* @param Carbon $end * @param Carbon $end
* @param boolean $shared * @param boolean $shared
* *
* @return Account * @return BillCollection
*/ */
public function getBillReport(Carbon $start, Carbon $end, $shared); public function getBillReport(Carbon $start, Carbon $end, $shared);

View File

@ -240,11 +240,6 @@ class PiggyBankController extends Controller
// create event // create event
$repository->createEvent($piggyBank, $amount); $repository->createEvent($piggyBank, $amount);
/*
* Create event!
*/
//Event::fire('piggy_bank.addMoney', [$piggyBank, $amount]); // new and used.
Session::flash('success', 'Added ' . Amount::format($amount, false) . ' to "' . e($piggyBank->name) . '".'); Session::flash('success', 'Added ' . Amount::format($amount, false) . ' to "' . e($piggyBank->name) . '".');
} else { } else {
Session::flash('error', 'Could not add ' . Amount::format($amount, false) . ' to "' . e($piggyBank->name) . '".'); Session::flash('error', 'Could not add ' . Amount::format($amount, false) . ' to "' . e($piggyBank->name) . '".');

View File

@ -2,6 +2,7 @@
namespace FireflyIII\Http\Requests; namespace FireflyIII\Http\Requests;
use App;
use Auth; use Auth;
use Carbon\Carbon; use Carbon\Carbon;
use Exception; use Exception;
@ -85,7 +86,7 @@ class JournalFormRequest extends Request
$rules['category'] = 'between:1,255'; $rules['category'] = 'between:1,255';
break; break;
default: default:
throw new Exception('Cannot handle ' . $what); App::abort(500, 'Cannot handle ' . $what);
break; break;
} }

View File

@ -13,10 +13,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
// models // models
/** @noinspection PhpUnusedParameterInspection */
Route::bind( Route::bind(
'account', 'account',
function ($value, $route) { function ($value) {
if (Auth::check()) { if (Auth::check()) {
$object = Account::leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') $object = Account::leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
->where('account_types.editable', 1) ->where('account_types.editable', 1)
@ -31,9 +30,8 @@ Route::bind(
} }
); );
/** @noinspection PhpUnusedParameterInspection */
Route::bind( Route::bind(
'tj', function ($value, $route) { 'tj', function ($value) {
if (Auth::check()) { if (Auth::check()) {
$object = TransactionJournal::where('id', $value)->where('user_id', Auth::user()->id)->first(); $object = TransactionJournal::where('id', $value)->where('user_id', Auth::user()->id)->first();
if ($object) { if ($object) {
@ -45,9 +43,8 @@ Route::bind(
} }
); );
/** @noinspection PhpUnusedParameterInspection */
Route::bind( Route::bind(
'currency', function ($value, $route) { 'currency', function ($value) {
if (Auth::check()) { if (Auth::check()) {
$object = TransactionCurrency::find($value); $object = TransactionCurrency::find($value);
if ($object) { if ($object) {
@ -58,9 +55,8 @@ Route::bind(
} }
); );
/** @noinspection PhpUnusedParameterInspection */
Route::bind( Route::bind(
'bill', function ($value, $route) { 'bill', function ($value) {
if (Auth::check()) { if (Auth::check()) {
$object = Bill::where('id', $value)->where('user_id', Auth::user()->id)->first(); $object = Bill::where('id', $value)->where('user_id', Auth::user()->id)->first();
if ($object) { if ($object) {
@ -72,9 +68,8 @@ Route::bind(
} }
); );
/** @noinspection PhpUnusedParameterInspection */
Route::bind( Route::bind(
'budget', function ($value, $route) { 'budget', function ($value) {
if (Auth::check()) { if (Auth::check()) {
$object = Budget::where('id', $value)->where('user_id', Auth::user()->id)->first(); $object = Budget::where('id', $value)->where('user_id', Auth::user()->id)->first();
if ($object) { if ($object) {
@ -86,9 +81,8 @@ Route::bind(
} }
); );
/** @noinspection PhpUnusedParameterInspection */
Route::bind( Route::bind(
'reminder', function ($value, $route) { 'reminder', function ($value) {
if (Auth::check()) { if (Auth::check()) {
$object = Reminder::where('id', $value)->where('user_id', Auth::user()->id)->first(); $object = Reminder::where('id', $value)->where('user_id', Auth::user()->id)->first();
if ($object) { if ($object) {
@ -100,9 +94,8 @@ Route::bind(
} }
); );
/** @noinspection PhpUnusedParameterInspection */
Route::bind( Route::bind(
'limitrepetition', function ($value, $route) { 'limitrepetition', function ($value) {
if (Auth::check()) { if (Auth::check()) {
$object = LimitRepetition::where('limit_repetitions.id', $value) $object = LimitRepetition::where('limit_repetitions.id', $value)
->leftjoin('budget_limits', 'budget_limits.id', '=', 'limit_repetitions.budget_limit_id') ->leftjoin('budget_limits', 'budget_limits.id', '=', 'limit_repetitions.budget_limit_id')
@ -118,9 +111,8 @@ Route::bind(
} }
); );
/** @noinspection PhpUnusedParameterInspection */
Route::bind( Route::bind(
'piggyBank', function ($value, $route) { 'piggyBank', function ($value) {
if (Auth::check()) { if (Auth::check()) {
$object = PiggyBank::where('piggy_banks.id', $value) $object = PiggyBank::where('piggy_banks.id', $value)
->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id') ->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')
@ -135,9 +127,8 @@ Route::bind(
} }
); );
/** @noinspection PhpUnusedParameterInspection */
Route::bind( Route::bind(
'category', function ($value, $route) { 'category', function ($value) {
if (Auth::check()) { if (Auth::check()) {
$object = Category::where('id', $value)->where('user_id', Auth::user()->id)->first(); $object = Category::where('id', $value)->where('user_id', Auth::user()->id)->first();
if ($object) { if ($object) {
@ -151,7 +142,7 @@ Route::bind(
/** @noinspection PhpUnusedParameterInspection */ /** @noinspection PhpUnusedParameterInspection */
Route::bind( Route::bind(
'reminder', function ($value, $route) { 'reminder', function ($value) {
if (Auth::check()) { if (Auth::check()) {
/** @var \FireflyIII\Models\Reminder $object */ /** @var \FireflyIII\Models\Reminder $object */
$object = Reminder::find($value); $object = Reminder::find($value);
@ -166,9 +157,8 @@ Route::bind(
} }
); );
/** @noinspection PhpUnusedParameterInspection */
Route::bind( Route::bind(
'tag', function ($value, $route) { 'tag', function ($value) {
if (Auth::check()) { if (Auth::check()) {
$object = Tag::where('id', $value)->where('user_id', Auth::user()->id)->first(); $object = Tag::where('id', $value)->where('user_id', Auth::user()->id)->first();
if ($object) { if ($object) {