2019-07-02 05:28:27 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models\Product;
|
|
|
|
|
2022-02-01 05:40:46 +00:00
|
|
|
use Illuminate\Support\Collection;
|
2019-07-02 05:28:27 +00:00
|
|
|
|
2022-02-01 05:40:46 +00:00
|
|
|
use App\Interfaces\ProductItem;
|
2023-05-04 12:17:42 +00:00
|
|
|
use App\Models\Invoice;
|
2022-04-19 07:07:39 +00:00
|
|
|
use App\Models\Service\Phone as ServicePhone;
|
|
|
|
use App\Models\Supplier\Phone as SupplierPhone;
|
2021-12-24 01:14:01 +00:00
|
|
|
|
2022-04-19 07:07:39 +00:00
|
|
|
final class Phone extends Type implements ProductItem
|
2022-02-01 05:40:46 +00:00
|
|
|
{
|
2022-04-19 07:07:39 +00:00
|
|
|
protected $table = 'product_phone';
|
2021-12-24 01:14:01 +00:00
|
|
|
|
2022-04-04 10:29:45 +00:00
|
|
|
protected array $order_attributes = [
|
2021-12-24 01:14:01 +00:00
|
|
|
'options.phonenumber'=>[
|
|
|
|
'request'=>'options.phonenumber',
|
|
|
|
'key'=>'service_number',
|
2022-04-19 07:07:39 +00:00
|
|
|
'validation'=>'nullable|size:10|unique:service_phone,service_number',
|
2021-12-24 01:14:01 +00:00
|
|
|
'validation_message'=>'Phone Number is a required field.',
|
|
|
|
],
|
|
|
|
'options.supplier'=>[
|
|
|
|
'request'=>'options.supplier',
|
|
|
|
'key'=>'order_info.supplier',
|
|
|
|
'validation'=>'required_with:options.phonenumber',
|
|
|
|
'validation_message'=>'Phone Supplier is a required field.',
|
|
|
|
],
|
|
|
|
'options.supplieraccnum'=>[
|
|
|
|
'request'=>'options.supplieraccnum',
|
|
|
|
'key'=>'order_info.supplieraccnum',
|
|
|
|
'validation'=>'required_with:options.phonenumber',
|
|
|
|
'validation_message'=>'Phone Supplier Account Number is a required field.',
|
|
|
|
],
|
|
|
|
'options.notes'=>[
|
|
|
|
'request'=>'options.notes',
|
|
|
|
'key'=>'order_info.notes',
|
|
|
|
'validation'=>'required_if:options.phonenumber,null',
|
|
|
|
'validation_message'=>'Special Instructions here.',
|
|
|
|
],
|
|
|
|
];
|
|
|
|
|
2022-02-01 05:40:46 +00:00
|
|
|
// The model that is referenced when this product is ordered
|
2022-04-19 07:07:39 +00:00
|
|
|
protected string $order_model = ServicePhone::class;
|
2022-02-01 05:40:46 +00:00
|
|
|
|
2023-05-04 12:17:42 +00:00
|
|
|
// When comparing billing/pricing/charging, what metric to normalise to
|
|
|
|
const DefaultBill = Invoice::BILL_MONTHLY;
|
2023-05-04 00:02:25 +00:00
|
|
|
// The model that the supplier supplies
|
|
|
|
const SupplierModel = SupplierPhone::class;
|
2022-02-01 05:40:46 +00:00
|
|
|
|
|
|
|
/* INTERFACES */
|
2021-12-24 01:14:01 +00:00
|
|
|
|
2022-02-01 05:40:46 +00:00
|
|
|
public function allowance(): Collection
|
|
|
|
{
|
|
|
|
// TODO: Implement allowance() method.
|
|
|
|
}
|
|
|
|
|
|
|
|
public function allowance_string(): string
|
|
|
|
{
|
2022-03-05 02:49:50 +00:00
|
|
|
return "(TBA)";
|
2022-02-01 05:40:46 +00:00
|
|
|
}
|
|
|
|
|
2023-05-05 05:48:24 +00:00
|
|
|
public function hasUsage(): bool
|
2022-02-01 05:40:46 +00:00
|
|
|
{
|
2023-05-05 05:48:24 +00:00
|
|
|
return FALSE;
|
2022-02-01 05:40:46 +00:00
|
|
|
}
|
2019-07-02 05:28:27 +00:00
|
|
|
}
|