mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-16 06:38:09 +00:00
Stuff for categories.
This commit is contained in:
@@ -54,7 +54,7 @@ class AccountController extends Controller
|
||||
{
|
||||
$subTitle = 'Delete ' . strtolower(e($account->accountType->type)) . ' "' . e($account->name) . '"';
|
||||
|
||||
return View::make('accounts.delete', compact('account', 'subTitle'));
|
||||
return view('accounts.delete', compact('account', 'subTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,7 +134,7 @@ class AccountController extends Controller
|
||||
$journals = $repository->getJournals($account, $page, $range);
|
||||
$subTitle = 'Details for ' . strtolower(e($account->accountType->type)) . ' "' . e($account->name) . '"';
|
||||
|
||||
return View::make('accounts.show', compact('account', 'what', 'range', 'subTitleIcon', 'journals', 'subTitle'));
|
||||
return view('accounts.show', compact('account', 'what', 'range', 'subTitleIcon', 'journals', 'subTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,7 +49,7 @@ class BudgetController extends Controller
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return View::make('budgets.create')->with('subTitle', 'Create a new budget');
|
||||
return view('budgets.create')->with('subTitle', 'Create a new budget');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,7 +61,7 @@ class BudgetController extends Controller
|
||||
{
|
||||
$subTitle = 'Delete budget' . e($budget->name) . '"';
|
||||
|
||||
return View::make('budgets.delete', compact('budget', 'subTitle'));
|
||||
return view('budgets.delete', compact('budget', 'subTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,7 +89,7 @@ class BudgetController extends Controller
|
||||
{
|
||||
$subTitle = 'Edit budget "' . e($budget->name) . '"';
|
||||
|
||||
return View::make('budgets.edit', compact('budget', 'subTitle'));
|
||||
return view('budgets.edit', compact('budget', 'subTitle'));
|
||||
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ class BudgetController extends Controller
|
||||
$budgetMax = Preferences::get('budgetMaximum', 1000);
|
||||
$budgetMaximum = $budgetMax->data;
|
||||
|
||||
return View::make('budgets.index', compact('budgetMaximum', 'budgets', 'spent', 'spentPCT', 'overspent', 'amount'));
|
||||
return view('budgets.index', compact('budgetMaximum', 'budgets', 'spent', 'spentPCT', 'overspent', 'amount'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,7 +137,7 @@ class BudgetController extends Controller
|
||||
->get(['transaction_journals.*']);
|
||||
$subTitle = 'Transactions without a budget in ' . $start->format('F Y');
|
||||
|
||||
return View::make('budgets.noBudget', compact('list', 'subTitle'));
|
||||
return view('budgets.noBudget', compact('list', 'subTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -176,7 +176,7 @@ class BudgetController extends Controller
|
||||
public function show(Budget $budget, LimitRepetition $repetition = null, BudgetRepositoryInterface $repository)
|
||||
{
|
||||
if (!is_null($repetition->id) && $repetition->budgetLimit->budget->id != $budget->id) {
|
||||
return View::make('error')->with('message', 'Invalid selection.');
|
||||
return view('error')->with('message', 'Invalid selection.');
|
||||
}
|
||||
|
||||
$hideBudget = true; // used in transaction list.
|
||||
@@ -184,7 +184,7 @@ class BudgetController extends Controller
|
||||
$limits = !is_null($repetition->id) ? [$repetition->budgetLimit] : $budget->budgetLimits()->orderBy('startdate', 'DESC')->get();
|
||||
$subTitle = !is_null($repetition->id) ? e($budget->name) . ' in ' . $repetition->startdate->format('F Y') : e($budget->name);
|
||||
|
||||
return View::make('budgets.show', compact('limits', 'budget', 'repetition', 'journals', 'subTitle', 'hideBudget'));
|
||||
return view('budgets.show', compact('limits', 'budget', 'repetition', 'journals', 'subTitle', 'hideBudget'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -216,7 +216,7 @@ class BudgetController extends Controller
|
||||
$date = Session::get('start', Carbon::now()->startOfMonth())->format('FY');
|
||||
$budgetAmount = Preferences::get('budgetIncomeTotal' . $date, 1000);
|
||||
|
||||
return View::make('budgets.income')->with('amount', $budgetAmount);
|
||||
return view('budgets.income')->with('amount', $budgetAmount);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
127
app/Http/Controllers/CategoryController.php
Normal file
127
app/Http/Controllers/CategoryController.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php namespace FireflyIII\Http\Controllers;
|
||||
|
||||
use Auth;
|
||||
use FireflyIII\Http\Requests;
|
||||
use FireflyIII\Http\Requests\CategoryFormRequest;
|
||||
use FireflyIII\Models\Category;
|
||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||
use Redirect;
|
||||
use Session;
|
||||
use View;
|
||||
|
||||
/**
|
||||
* Class CategoryController
|
||||
*
|
||||
* @package FireflyIII\Http\Controllers
|
||||
*/
|
||||
class CategoryController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
View::share('title', 'Categories');
|
||||
View::share('mainTitleIcon', 'fa-bar-chart');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('categories.create')->with('subTitle', 'Create a new category');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Category $category
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function delete(Category $category)
|
||||
{
|
||||
$subTitle = 'Delete category' . e($category->name) . '"';
|
||||
|
||||
return view('categories.delete', compact('category', 'subTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Category $category
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function destroy(Category $category, CategoryRepositoryInterface $repository)
|
||||
{
|
||||
|
||||
$name = $category->name;
|
||||
$repository->destroy($category);
|
||||
|
||||
Session::flash('success', 'The category "' . e($name) . '" was deleted.');
|
||||
|
||||
return Redirect::route('categories.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Category $category
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function edit(Category $category)
|
||||
{
|
||||
$subTitle = 'Edit category "' . e($category->name) . '"';
|
||||
|
||||
return view('categories.edit', compact('category', 'subTitle'));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$categories = Auth::user()->categories()->get();
|
||||
|
||||
return view('categories.index', compact('categories'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CategoryFormRequest $request
|
||||
* @param CategoryRepositoryInterface $repository
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function store(CategoryFormRequest $request, CategoryRepositoryInterface $repository)
|
||||
{
|
||||
$categoryData = [
|
||||
'name' => $request->input('name'),
|
||||
'user' => Auth::user()->id,
|
||||
];
|
||||
$category = $repository->store($categoryData);
|
||||
|
||||
Session::flash('success', 'New category "' . $category->name . '" stored!');
|
||||
|
||||
return Redirect::route('categories.index');
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Category $category
|
||||
* @param CategoryFormRequest $request
|
||||
* @param CategoryRepositoryInterface $repository
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(Category $category, CategoryFormRequest $request, CategoryRepositoryInterface $repository)
|
||||
{
|
||||
$categoryData = [
|
||||
'name' => $request->input('name'),
|
||||
];
|
||||
|
||||
$repository->update($category, $categoryData);
|
||||
|
||||
Session::flash('success', 'Category "' . $category->name . '" updated.');
|
||||
|
||||
return Redirect::route('categories.index');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user