Use map() instead of transform(), use fn() instead of function(), consistent coding for form.select
This commit is contained in:
@@ -399,11 +399,11 @@ class ServiceController extends Controller
|
||||
// We dynamically create our validation
|
||||
$validator = Validator::make(
|
||||
$request->post(),
|
||||
$x=collect($o->type->validation())
|
||||
collect($o->type->validation())
|
||||
->keys()
|
||||
->transform(fn($item)=>sprintf('%s.%s',$o->product->category,$item))
|
||||
->map(fn($item)=>sprintf('%s.%s',$o->product->category,$item))
|
||||
->combine(array_values($o->type->validation()))
|
||||
->transform(fn($item)=>is_string($item)
|
||||
->map(fn($item)=>is_string($item)
|
||||
? preg_replace('/^exclude_without:/',sprintf('exclude_without:%s.',$o->product->category),$item)
|
||||
: $item)
|
||||
->merge(
|
||||
|
@@ -62,7 +62,7 @@ class ImportCosts implements ShouldQueue
|
||||
'PRICETOTAL'=>'Total (inc-GST)'
|
||||
];
|
||||
|
||||
$this->columns = collect($headers)->transform(function($item) { return strtolower($item); });
|
||||
$this->columns = collect($headers)->map(fn($item)=>strtolower($item));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -367,7 +367,7 @@ class Product extends Model implements IDs
|
||||
return round($price,2);
|
||||
}
|
||||
|
||||
public function accounting(string $provider): Collection
|
||||
public function accounting(): Collection
|
||||
{
|
||||
$so = ProviderOauth::where('name',self::provider)
|
||||
->sole();
|
||||
@@ -379,7 +379,7 @@ class Product extends Model implements IDs
|
||||
->API()
|
||||
->getItems()
|
||||
->pluck('pid','Id')
|
||||
->transform(fn($item,$value)=>['id'=>$value,'value'=>$item])
|
||||
->map(fn($item,$value)=>['id'=>$value,'value'=>$item])
|
||||
->values();
|
||||
}
|
||||
|
||||
|
@@ -21,7 +21,7 @@ abstract class Type extends Model
|
||||
*/
|
||||
final public function products()
|
||||
{
|
||||
return $this->morphMany(Product::class, null,'model','model_id');
|
||||
return $this->morphMany(Product::class,null,'model','model_id');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -140,7 +140,7 @@ class Broadband extends Type
|
||||
}
|
||||
|
||||
if ($config->has('metric') AND $config->get('metric'))
|
||||
$result->transform(function($item) use ($config,$ceil) {
|
||||
$result->map(function($item) use ($config,$ceil) {
|
||||
return $ceil
|
||||
? (int)ceil($item/$config->get('metric'))
|
||||
: $item/$config->get('metric');
|
||||
|
Reference in New Issue
Block a user