akaunting 3.0 (the last dance)
This commit is contained in:
@ -13,11 +13,19 @@ class Account extends FormRequest
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$type = $this->request->get('type', 'bank');
|
||||
$opening_balance = 'required';
|
||||
|
||||
if ($type == 'bank') {
|
||||
$opening_balance = '|amount:0';
|
||||
}
|
||||
|
||||
return [
|
||||
'type' => 'required|string',
|
||||
'name' => 'required|string',
|
||||
'number' => 'required|string',
|
||||
'currency_code' => 'required|string|currency',
|
||||
'opening_balance' => 'required',
|
||||
'opening_balance' => $opening_balance,
|
||||
'enabled' => 'integer|boolean',
|
||||
];
|
||||
}
|
||||
|
@ -20,8 +20,19 @@ class Transaction extends FormRequest
|
||||
$attachment = 'mimes:' . config('filesystems.mimes') . '|between:0,' . config('filesystems.max_size') * 1024;
|
||||
}
|
||||
|
||||
// Check if store or update
|
||||
if ($this->getMethod() == 'PATCH') {
|
||||
$id = $this->transaction->getAttribute('id');
|
||||
} else {
|
||||
$id = null;
|
||||
}
|
||||
|
||||
// Get company id
|
||||
$company_id = (int) $this->request->get('company_id');
|
||||
|
||||
return [
|
||||
'type' => 'required|string',
|
||||
'number' => 'required|string|unique:transactions,NULL,' . $id . ',id,company_id,' . $company_id . ',deleted_at,NULL',
|
||||
'account_id' => 'required|integer',
|
||||
'paid_at' => 'required|date_format:Y-m-d H:i:s',
|
||||
'amount' => 'required|amount',
|
||||
|
22
app/Http/Requests/Banking/TransactionConnect.php
Normal file
22
app/Http/Requests/Banking/TransactionConnect.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Banking;
|
||||
|
||||
use App\Abstracts\Http\FormRequest;
|
||||
|
||||
class TransactionConnect extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'data' => 'required|array',
|
||||
'data.items' => 'required|array',
|
||||
'data.items.*.document_id' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user