2014-06-28 02:41:44 -05:00
|
|
|
<?php
|
2014-07-26 11:53:41 -05:00
|
|
|
|
|
|
|
// models:
|
|
|
|
Route::bind('account', function($value, $route)
|
|
|
|
{
|
2014-07-27 13:29:58 -05:00
|
|
|
if(Auth::check()) {
|
|
|
|
return Account::
|
|
|
|
where('id', $value)->
|
|
|
|
where('user_id',Auth::user()->id)->first();
|
|
|
|
}
|
|
|
|
return null;
|
2014-07-26 11:53:41 -05:00
|
|
|
});
|
2014-07-27 13:29:58 -05:00
|
|
|
Route::bind('budget', function($value, $route)
|
|
|
|
{
|
|
|
|
if(Auth::check()) {
|
|
|
|
return Budget::
|
|
|
|
where('id', $value)->
|
|
|
|
where('user_id',Auth::user()->id)->first();
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
});
|
|
|
|
|
2014-07-30 07:45:46 -05:00
|
|
|
Route::bind('category', function($value, $route)
|
|
|
|
{
|
|
|
|
if(Auth::check()) {
|
|
|
|
return Category::
|
|
|
|
where('id', $value)->
|
|
|
|
where('user_id',Auth::user()->id)->first();
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
});
|
2014-07-26 11:53:41 -05:00
|
|
|
|
2014-07-30 15:31:35 -05:00
|
|
|
Route::bind('limit', function($value, $route)
|
|
|
|
{
|
|
|
|
if(Auth::check()) {
|
|
|
|
return Limit::
|
|
|
|
where('limits.id', $value)->
|
|
|
|
leftJoin('components','components.id','=','limits.component_id')->
|
|
|
|
where('components.class','Budget')->
|
2014-07-31 00:29:55 -05:00
|
|
|
where('components.user_id',Auth::user()->id)->first(['limits.*']);
|
2014-07-30 15:31:35 -05:00
|
|
|
}
|
|
|
|
return null;
|
|
|
|
});
|
|
|
|
|
2014-07-26 11:53:41 -05:00
|
|
|
|
2014-07-04 04:39:21 -05:00
|
|
|
// protected routes:
|
|
|
|
Route::group(['before' => 'auth'], function () {
|
|
|
|
|
|
|
|
// home controller
|
|
|
|
Route::get('/', ['uses' => 'HomeController@index', 'as' => 'index']);
|
2014-07-24 15:16:42 -05:00
|
|
|
Route::get('/flush', ['uses' => 'HomeController@flush', 'as' => 'flush']);
|
2014-07-04 04:39:21 -05:00
|
|
|
|
2014-07-06 08:18:11 -05:00
|
|
|
// chart controller
|
2014-07-29 05:55:41 -05:00
|
|
|
Route::get('/chart/home/account/{account?}', ['uses' => 'ChartController@homeAccount', 'as' => 'chart.home']);
|
2014-07-09 05:56:06 -05:00
|
|
|
Route::get('/chart/home/categories', ['uses' => 'ChartController@homeCategories', 'as' => 'chart.categories']);
|
2014-07-25 05:12:08 -05:00
|
|
|
Route::get('/chart/home/budgets', ['uses' => 'ChartController@homeBudgets', 'as' => 'chart.budgets']);
|
2014-07-26 11:53:41 -05:00
|
|
|
Route::get('/chart/home/info/{accountname}/{day}/{month}/{year}', ['uses' => 'ChartController@homeAccountInfo', 'as' => 'chart.info']);
|
2014-07-30 07:45:46 -05:00
|
|
|
Route::get('/chart/categories/show/{category}', ['uses' => 'ChartController@categoryShowChart','as' => 'chart.showcategory']);
|
2014-07-17 13:52:54 -05:00
|
|
|
|
2014-07-30 00:14:00 -05:00
|
|
|
// Categories controller:
|
|
|
|
Route::get('/categories',['uses' => 'CategoryController@index','as' => 'categories.index']);
|
|
|
|
Route::get('/categories/create',['uses' => 'CategoryController@create','as' => 'categories.create']);
|
|
|
|
Route::get('/categories/show/{category}',['uses' => 'CategoryController@show','as' => 'categories.show']);
|
|
|
|
Route::get('/categories/edit/{category}',['uses' => 'CategoryController@edit','as' => 'categories.edit']);
|
|
|
|
Route::get('/categories/delete/{category}',['uses' => 'CategoryController@delete','as' => 'categories.delete']);
|
|
|
|
|
2014-07-31 15:01:52 -05:00
|
|
|
// piggy bank controller
|
|
|
|
Route::get('/piggybanks',['uses' => 'PiggybankController@index','as' => 'piggybanks.index']);
|
|
|
|
Route::get('/piggybanks/create', ['uses' => 'PiggybankController@create','as' => 'piggybanks.create']);
|
|
|
|
|
2014-07-06 08:18:11 -05:00
|
|
|
|
|
|
|
// preferences controller
|
|
|
|
Route::get('/preferences', ['uses' => 'PreferencesController@index', 'as' => 'preferences']);
|
|
|
|
|
2014-07-04 04:39:21 -05:00
|
|
|
// user controller
|
|
|
|
Route::get('/logout', ['uses' => 'UserController@logout', 'as' => 'logout']);
|
|
|
|
|
|
|
|
//profile controller
|
|
|
|
Route::get('/profile', ['uses' => 'ProfileController@index', 'as' => 'profile']);
|
|
|
|
Route::get('/profile/change-password',['uses' => 'ProfileController@changePassword', 'as' => 'change-password']);
|
|
|
|
|
2014-07-06 08:18:11 -05:00
|
|
|
// account controller:
|
|
|
|
Route::get('/accounts', ['uses' => 'AccountController@index', 'as' => 'accounts.index']);
|
|
|
|
Route::get('/accounts/create', ['uses' => 'AccountController@create', 'as' => 'accounts.create']);
|
|
|
|
Route::get('/accounts/{account}', ['uses' => 'AccountController@show', 'as' => 'accounts.show']);
|
2014-07-26 01:05:02 -05:00
|
|
|
Route::get('/accounts/{account}/edit', ['uses' => 'AccountController@edit', 'as' => 'accounts.edit']);
|
|
|
|
Route::get('/accounts/{account}/delete', ['uses' => 'AccountController@delete', 'as' => 'accounts.delete']);
|
2014-07-06 08:18:11 -05:00
|
|
|
|
2014-07-20 11:24:27 -05:00
|
|
|
// budget controller:
|
2014-07-24 15:16:42 -05:00
|
|
|
Route::get('/budgets',['uses' => 'BudgetController@indexByDate','as' => 'budgets.index']);
|
2014-07-30 00:14:00 -05:00
|
|
|
Route::get('/budgets/create',['uses' => 'BudgetController@create', 'as' => 'budgets.create']);
|
2014-07-24 15:16:42 -05:00
|
|
|
Route::get('/budgets/budget',['uses' => 'BudgetController@indexByBudget','as' => 'budgets.index.budget']);
|
2014-07-28 07:53:04 -05:00
|
|
|
Route::get('/budgets/show/{budget}',['uses' => 'BudgetController@show', 'as' => 'budgets.show']);
|
|
|
|
Route::get('/budgets/edit/{budget}',['uses' => 'BudgetController@edit', 'as' => 'budgets.edit']);
|
|
|
|
Route::get('/budgets/delete/{budget}',['uses' => 'BudgetController@delete', 'as' => 'budgets.delete']);
|
2014-07-20 11:24:27 -05:00
|
|
|
|
2014-07-31 15:01:52 -05:00
|
|
|
|
2014-07-20 11:24:27 -05:00
|
|
|
// limit controller:
|
2014-07-30 15:31:35 -05:00
|
|
|
Route::get('/budgets/limits/create/{budget?}',['uses' => 'LimitController@create','as' => 'budgets.limits.create']);
|
|
|
|
Route::get('/budgets/limits/delete/{limit}',['uses' => 'LimitController@delete','as' => 'budgets.limits.delete']);
|
|
|
|
Route::get('/budgets/limits/edit/{limit}',['uses' => 'LimitController@edit','as' => 'budgets.limits.edit']);
|
2014-07-17 13:52:54 -05:00
|
|
|
|
2014-07-14 23:57:20 -05:00
|
|
|
// JSON controller:
|
|
|
|
Route::get('/json/beneficiaries', ['uses' => 'JsonController@beneficiaries', 'as' => 'json.beneficiaries']);
|
|
|
|
Route::get('/json/categories', ['uses' => 'JsonController@categories', 'as' => 'json.categories']);
|
|
|
|
|
|
|
|
|
2014-07-08 07:04:02 -05:00
|
|
|
// transaction controller:
|
2014-07-23 23:47:28 -05:00
|
|
|
Route::get('/transactions/create/{what}', ['uses' => 'TransactionController@create', 'as' => 'transactions.create'])->where(['what' => 'withdrawal|deposit|transfer']);
|
2014-07-16 14:11:43 -05:00
|
|
|
Route::get('/transaction/show/{id}',['uses' => 'TransactionController@show','as' => 'transactions.show']);
|
|
|
|
Route::get('/transaction/edit/{id}',['uses' => 'TransactionController@edit','as' => 'transactions.edit']);
|
|
|
|
Route::get('/transaction/delete/{id}',['uses' => 'TransactionController@delete','as' => 'transactions.delete']);
|
2014-07-25 00:17:56 -05:00
|
|
|
Route::get('/transactions/index',['uses' => 'TransactionController@index','as' => 'transactions.index']);
|
2014-07-04 04:39:21 -05:00
|
|
|
// migration controller
|
|
|
|
Route::get('/migrate', ['uses' => 'MigrationController@index', 'as' => 'migrate']);
|
2014-07-05 12:44:26 -05:00
|
|
|
|
2014-07-04 04:39:21 -05:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2014-07-05 12:44:26 -05:00
|
|
|
// protected + csrf routes (POST)
|
2014-07-04 04:39:21 -05:00
|
|
|
Route::group(['before' => 'csrf|auth'], function () {
|
|
|
|
// profile controller
|
|
|
|
Route::post('/profile/change-password', ['uses' => 'ProfileController@postChangePassword']);
|
|
|
|
|
2014-07-20 11:24:27 -05:00
|
|
|
// budget controller:
|
2014-07-30 15:31:35 -05:00
|
|
|
Route::post('/budgets/store/{budget}',['uses' => 'BudgetController@store', 'as' => 'budgets.store']);
|
2014-07-28 07:53:04 -05:00
|
|
|
Route::post('/budgets/update', ['uses' => 'BudgetController@update', 'as' => 'budgets.update']);
|
|
|
|
Route::post('/budgets/destroy', ['uses' => 'BudgetController@destroy', 'as' => 'budgets.destroy']);
|
2014-07-20 11:24:27 -05:00
|
|
|
|
2014-07-30 07:45:46 -05:00
|
|
|
// category controller
|
|
|
|
Route::post('/categories/store',['uses' => 'CategoryController@store', 'as' => 'categories.store']);
|
|
|
|
Route::post('/categories/update', ['uses' => 'CategoryController@update', 'as' => 'categories.update']);
|
|
|
|
Route::post('/categories/destroy', ['uses' => 'CategoryController@destroy', 'as' => 'categories.destroy']);
|
|
|
|
|
2014-07-04 04:39:21 -05:00
|
|
|
// migration controller
|
|
|
|
Route::post('/migrate', ['uses' => 'MigrationController@postIndex']);
|
|
|
|
|
2014-07-31 15:01:52 -05:00
|
|
|
// piggy bank controller
|
|
|
|
Route::post('/piggybanks/store',['uses' => 'PiggybankController@store','as' => 'piggybanks.store']);
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-07-06 08:18:11 -05:00
|
|
|
// preferences controller
|
|
|
|
Route::post('/preferences', ['uses' => 'PreferencesController@postIndex']);
|
|
|
|
|
2014-07-05 12:44:26 -05:00
|
|
|
// account controller:
|
2014-07-26 01:05:02 -05:00
|
|
|
Route::post('/accounts/store', ['uses' => 'AccountController@store', 'as' => 'accounts.store']);
|
|
|
|
Route::post('/accounts/update', ['uses' => 'AccountController@update', 'as' => 'accounts.update']);
|
|
|
|
Route::post('/accounts/destroy', ['uses' => 'AccountController@destroy', 'as' => 'accounts.destroy']);
|
2014-07-05 12:44:26 -05:00
|
|
|
|
2014-07-20 11:24:27 -05:00
|
|
|
// limit controller:
|
2014-07-30 15:31:35 -05:00
|
|
|
Route::post('/budgets/limits/store/{budget?}', ['uses' => 'LimitController@store', 'as' => 'budgets.limits.store']);
|
2014-07-23 01:16:04 -05:00
|
|
|
Route::post('/budgets/limits/destroy/{id?}',['uses' => 'LimitController@destroy','as' => 'budgets.limits.destroy']);
|
2014-07-23 23:47:28 -05:00
|
|
|
Route::post('/budgets/limits/update/{id?}',['uses' => 'LimitController@update','as' => 'budgets.limits.update']);
|
2014-07-20 11:24:27 -05:00
|
|
|
|
2014-07-15 04:04:53 -05:00
|
|
|
// transaction controller:
|
2014-07-16 14:11:43 -05:00
|
|
|
Route::post('/transactions/store/{what}', ['uses' => 'TransactionController@store', 'as' => 'transactions.store'])
|
|
|
|
->where(['what' => 'withdrawal|deposit|transfer']);
|
|
|
|
Route::post('/transaction/update/{id}',['uses' => 'TransactionController@update','as' => 'transactions.update']);
|
2014-07-15 04:04:53 -05:00
|
|
|
|
2014-07-04 04:39:21 -05:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
// guest routes:
|
2014-07-05 09:19:15 -05:00
|
|
|
Route::group(['before' => 'guest'], function () {
|
2014-07-04 04:39:21 -05:00
|
|
|
// user controller
|
|
|
|
Route::get('/login', ['uses' => 'UserController@login', 'as' => 'login']);
|
|
|
|
Route::get('/register', ['uses' => 'UserController@register', 'as' => 'register']);
|
|
|
|
Route::get('/verify/{verification}', ['uses' => 'UserController@verify', 'as' => 'verify']);
|
|
|
|
Route::get('/reset/{reset}', ['uses' => 'UserController@reset', 'as' => 'reset']);
|
|
|
|
Route::get('/remindme', ['uses' => 'UserController@remindme', 'as' => 'remindme']);
|
2014-07-08 07:04:02 -05:00
|
|
|
|
|
|
|
// dev import route:
|
|
|
|
Route::get('/dev',['uses' => 'MigrationController@dev']);
|
2014-07-20 11:24:27 -05:00
|
|
|
Route::get('/limit',['uses' => 'MigrationController@limit']);
|
2014-07-04 04:39:21 -05:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
// guest + csrf routes:
|
|
|
|
Route::group(['before' => 'csrf|guest'], function () {
|
|
|
|
|
|
|
|
// user controller
|
|
|
|
Route::post('/login', ['uses' => 'UserController@postLogin']);
|
|
|
|
Route::post('/register', ['uses' => 'UserController@postRegister']);
|
|
|
|
Route::post('/remindme', ['uses' => 'UserController@postRemindme']);
|
|
|
|
}
|
|
|
|
);
|