mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Update category code for #4015
This commit is contained in:
parent
60a3cc1f72
commit
5d872bead7
@ -47,9 +47,7 @@ use League\Fractal\Resource\Item;
|
|||||||
class CategoryController extends Controller
|
class CategoryController extends Controller
|
||||||
{
|
{
|
||||||
use TransactionFilter;
|
use TransactionFilter;
|
||||||
|
private CategoryRepositoryInterface $repository;
|
||||||
/** @var CategoryRepositoryInterface The category repository */
|
|
||||||
private $repository;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,7 +45,8 @@ class CategoryStoreRequest extends FormRequest
|
|||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => $this->string('name'),
|
'name' => $this->string('name'),
|
||||||
|
'notes' => $this->nlString('notes'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +58,7 @@ class CategoryStoreRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => 'required|between:1,100|uniqueObjectForUser:categories,name'
|
'name' => 'required|between:1,100|uniqueObjectForUser:categories,name',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,15 @@ class CategoryUpdateRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
{
|
{
|
||||||
|
$notes = null;
|
||||||
|
$all = $this->all();
|
||||||
|
if (array_key_exists('notes', $all)) {
|
||||||
|
$notes = $this->nlString('notes');
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'name' => $this->string('name'),
|
'name' => $this->string('name'),
|
||||||
|
'notes' => $notes,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user