mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-09-03 05:41:07 +00:00
chore(receivables): remove legacy-era receivables sources
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Receivables\Http\Requests;
|
||||
|
||||
use App\Domains\Receivables\Models\PaymentMethod;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class PaymentMethodRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$data = [
|
||||
'name' => [
|
||||
'required',
|
||||
Rule::unique('payment_methods')
|
||||
->where('company_id', $this->header('company')),
|
||||
],
|
||||
];
|
||||
|
||||
if ($this->getMethod() == 'PUT') {
|
||||
$data['name'] = [
|
||||
'required',
|
||||
Rule::unique('payment_methods')
|
||||
->ignore($this->route('payment_method'), 'id')
|
||||
->where('company_id', $this->header('company')),
|
||||
];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getPaymentMethodPayload()
|
||||
{
|
||||
return collect($this->validated())
|
||||
->merge([
|
||||
'company_id' => $this->header('company'),
|
||||
'type' => PaymentMethod::TYPE_GENERAL,
|
||||
])
|
||||
->toArray();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user