Add edit supplier products (phone)
This commit is contained in:
@@ -148,4 +148,27 @@ class Broadband extends Type
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function validation(): array
|
||||
{
|
||||
// @todo Enhance the validation so that extra_* values are not accepted if base_* values are not included.
|
||||
return array_merge(parent::validation(),
|
||||
[
|
||||
'extra_shaped' => 'sometimes|accepted',
|
||||
'extra_charged' => 'sometimes|accepted',
|
||||
'metric' => 'nullable|numeric|min:1',
|
||||
'speed' => 'nullable|string|max:64',
|
||||
'technology' => 'nullable|string|max:255',
|
||||
'offpeak_start' => 'nullable|date_format:H:i',
|
||||
'offpeak_end' => 'nullable|date_format:H:i',
|
||||
'base_down_peak' => 'nullable|numeric',
|
||||
'base_up_peak' => 'nullable|numeric',
|
||||
'base_down_offpeak' => 'nullable|numeric',
|
||||
'base_up_offpeak' => 'nullable|numeric',
|
||||
'extra_down_peak' => 'nullable|numeric',
|
||||
'extra_up_peak' => 'nullable|numeric',
|
||||
'extra_down_offpeak' => 'nullable|numeric',
|
||||
'extra_up_offpeak' => 'nullable|numeric',
|
||||
]);
|
||||
}
|
||||
}
|
@@ -4,9 +4,10 @@ namespace App\Models\Supplier;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Leenooks\Traits\ScopeActive;
|
||||
|
||||
use App\Models\{Invoice,SupplierDetail};
|
||||
use App\Models\{Invoice, Supplier, SupplierDetail};
|
||||
use App\Traits\SiteID;
|
||||
|
||||
abstract class Type extends Model
|
||||
@@ -87,4 +88,23 @@ abstract class Type extends Model
|
||||
{
|
||||
return $this->supplier_detail->supplier;
|
||||
}
|
||||
|
||||
public function validation(): array
|
||||
{
|
||||
return [
|
||||
'id' => [
|
||||
'nullable',
|
||||
'numeric',
|
||||
sprintf('exists:%s,id',static::getTable())
|
||||
],
|
||||
'offering_type' => ['required',Rule::in(Supplier::offeringTypeKeys()->toArray())],
|
||||
'supplier_detail_id' => 'required|exists:supplier_details,id',
|
||||
'active' => 'sometimes|accepted',
|
||||
'base_cost' => 'required|numeric|min:0',
|
||||
'setup_cost' => 'nullable|numeric|min:0',
|
||||
'contract_term' => 'nullable|numeric|min:1',
|
||||
'product_id' => 'required|string|min:2',
|
||||
'product_desc' => 'required|string|min:2',
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user