mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-24 22:48:18 +00:00
Stuff for recurring transactions [skip ci]
This commit is contained in:
@@ -5,21 +5,36 @@ use Firefly\Storage\RecurringTransaction\RecurringTransactionRepositoryInterface
|
||||
class RecurringController extends BaseController
|
||||
{
|
||||
protected $_repository;
|
||||
|
||||
public function __construct(RTR $repository)
|
||||
{
|
||||
$this->_repository = $repository;
|
||||
View::share('menu', 'home');
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$periods = \Config::get('firefly.periods_to_text');
|
||||
|
||||
return View::make('recurring.create')->with('periods', $periods);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
public function delete(RecurringTransaction $recurringTransaction)
|
||||
{
|
||||
return View::make('recurring.delete')->with('recurringTransaction', $recurringTransaction);
|
||||
}
|
||||
|
||||
public function destroy()
|
||||
public function destroy(RecurringTransaction $recurringTransaction)
|
||||
{
|
||||
$result = $this->_repository->destroy($recurringTransaction);
|
||||
if ($result === true) {
|
||||
Session::flash('success', 'The recurring transaction was deleted.');
|
||||
} else {
|
||||
Session::flash('error', 'Could not delete the recurring transaction. Check the logs to be sure.');
|
||||
}
|
||||
|
||||
return Redirect::route('recurring.index');
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
@@ -29,7 +44,8 @@ class RecurringController extends BaseController
|
||||
public function index()
|
||||
{
|
||||
$list = $this->_repository->get();
|
||||
return View::make('recurring.index');
|
||||
|
||||
return View::make('recurring.index')->with('list', $list);
|
||||
}
|
||||
|
||||
public function show()
|
||||
@@ -38,6 +54,21 @@ class RecurringController extends BaseController
|
||||
|
||||
public function store()
|
||||
{
|
||||
$recurringTransaction = $this->_repository->store(Input::all());
|
||||
if ($recurringTransaction->id) {
|
||||
Session::flash('success', 'Recurring transaction "' . $recurringTransaction->name . '" saved!');
|
||||
if (Input::get('create') == '1') {
|
||||
return Redirect::route('recurring.create')->withInput();
|
||||
} else {
|
||||
return Redirect::route('recurring.index');
|
||||
}
|
||||
} else {
|
||||
Session::flash(
|
||||
'error', 'Could not save the recurring transaction: ' . $recurringTransaction->errors()->first()
|
||||
);
|
||||
|
||||
return Redirect::route('recurring.create')->withInput()->withErrors($recurringTransaction->errors());
|
||||
}
|
||||
}
|
||||
|
||||
public function update()
|
||||
|
Reference in New Issue
Block a user