Move category/category_name product::class methods into __get(), no functional changes
This commit is contained in:
@@ -401,10 +401,10 @@ class ServiceController extends Controller
|
||||
$request->post(),
|
||||
collect($o->type->validation())
|
||||
->keys()
|
||||
->map(fn($item)=>sprintf('%s.%s',$o->product->category,$item))
|
||||
->map(fn($item)=>sprintf('%s.%s',$o->product->category_lc,$item))
|
||||
->combine(array_values($o->type->validation()))
|
||||
->map(fn($item)=>is_string($item)
|
||||
? preg_replace('/^exclude_without:/',sprintf('exclude_without:%s.',$o->product->category),$item)
|
||||
? preg_replace('/^exclude_without:/',sprintf('exclude_without:%s.',$o->product->category_lc),$item)
|
||||
: $item)
|
||||
->merge(
|
||||
[
|
||||
@@ -416,7 +416,7 @@ class ServiceController extends Controller
|
||||
'price' => 'nullable|numeric|min:0', // Price we charge the client, if we dont charge supplied/price
|
||||
'cost' => 'nullable|numeric|min:0', // Price we are charged by supplier, if we arent charged supplier/price
|
||||
'supplierid' => 'nullable|string|min:1', // As used on invoices
|
||||
$o->product->category => 'array|min:1',
|
||||
$o->product->category_lc => 'array|min:1',
|
||||
]
|
||||
)
|
||||
->toArray()
|
||||
@@ -432,13 +432,13 @@ class ServiceController extends Controller
|
||||
$validated = collect($validator->validated());
|
||||
|
||||
// Store our service type values
|
||||
$o->type->forceFill($validated->get($o->product->category));
|
||||
$o->type->forceFill($validated->get($o->product->category_lc));
|
||||
|
||||
// Some special handling
|
||||
switch ($o->product->category) {
|
||||
switch ($o->product->category_lc) {
|
||||
case 'broadband':
|
||||
// If pppoe is not set, then we dont need username/password
|
||||
$o->type->pppoe = ($x=data_get($validated,$o->product->category.'.pppoe',FALSE));
|
||||
$o->type->pppoe = ($x=data_get($validated,$o->product->category_lc.'.pppoe',FALSE));
|
||||
|
||||
if (! $x) {
|
||||
$o->type->service_username = NULL;
|
||||
@@ -470,7 +470,7 @@ class ServiceController extends Controller
|
||||
|
||||
else {
|
||||
// For broadband, start_at is connect_at in the type record
|
||||
switch ($o->product->category) {
|
||||
switch ($o->product->category_lc) {
|
||||
case 'broadband':
|
||||
$o->start_at = $o->type->connect_at;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user