Bring back some services logic to still needed by charges
This commit is contained in:
19
app/Http/Controllers/ResellerServicesController.php
Normal file
19
app/Http/Controllers/ResellerServicesController.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
use App\Models\Account;
|
||||
|
||||
class ResellerServicesController extends Controller
|
||||
{
|
||||
public function services(Request $request,Account $o)
|
||||
{
|
||||
return $o->services
|
||||
->filter(function($item) use ($request) {
|
||||
return $item->active || ($item->id == $request->include);
|
||||
});
|
||||
}
|
||||
}
|
@@ -33,6 +33,7 @@ use App\Traits\SiteID;
|
||||
* + billing_interval_string : The period that this service is billed for by default as a name
|
||||
* + billed_to : When this service has been billed to // @todo rename all references to invoice_to
|
||||
* + category : The type of service this is, eg: broadband, phone
|
||||
* + category_name : The type of service this is, eg: Broadband, Telephone (in human friendly)
|
||||
* + contract_term : The term that this service must be active
|
||||
* + contract_end : The date that the contract ends for this service
|
||||
* + name : Service short name with service address
|
||||
@@ -65,6 +66,27 @@ class Service extends Model implements IDs
|
||||
'stop_at',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'category_name',
|
||||
'name_short',
|
||||
];
|
||||
|
||||
protected $visible = [
|
||||
// 'account_name',
|
||||
// 'admin_service_id_url',
|
||||
'active',
|
||||
'category_name',
|
||||
// 'billing_price',
|
||||
// 'data_orig',
|
||||
'id',
|
||||
'name_short',
|
||||
// 'next_invoice',
|
||||
// 'product.name',
|
||||
// 'service_id',
|
||||
// 'service_id_url',
|
||||
// 'status',
|
||||
];
|
||||
|
||||
protected $with = [
|
||||
'invoice_items',
|
||||
'product.type.supplied',
|
||||
@@ -483,6 +505,16 @@ class Service extends Model implements IDs
|
||||
return number_format($this->getBillingChargeAttribute()/Arr::get(Invoice::billing_periods,$this->recur_schedule.'.interval',1),2);
|
||||
}
|
||||
|
||||
public function getCategoryAttribute(): string
|
||||
{
|
||||
return $this->product->category;
|
||||
}
|
||||
|
||||
public function getCategoryNameAttribute(): string
|
||||
{
|
||||
return $this->product->category_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* The date the contract ends
|
||||
*
|
||||
|
Reference in New Issue
Block a user