diff --git a/app/Http/Controllers/OrderController.php b/app/Http/Controllers/OrderController.php index adc9982..7e97a5e 100644 --- a/app/Http/Controllers/OrderController.php +++ b/app/Http/Controllers/OrderController.php @@ -103,12 +103,12 @@ class OrderController extends Controller // @todo Make this automatic $so->site_id = config('site')->site_id; - $so->product_id = $request->input('product_id'); + $so->product_id = $po->id; $so->order_status = 'ORDER-SUBMIT'; $so->orderby_id = Auth::id(); - $so->model = get_class($order); + $so->model = $order ? get_class($order) : NULL; - if ($order->order_info) { + if ($order && $order->order_info) { $so->order_info = $order->order_info; unset($order->order_info); diff --git a/app/Models/Product/Broadband.php b/app/Models/Product/Broadband.php index b9ec9d5..893352d 100644 --- a/app/Models/Product/Broadband.php +++ b/app/Models/Product/Broadband.php @@ -17,7 +17,7 @@ final class Broadband extends Type implements ProductItem protected $table = 'product_broadband'; // Information required during the order process - private array $order_attributes = [ + protected array $order_attributes = [ 'options.address'=>[ 'request'=>'options.address', 'key'=>'service_address', diff --git a/app/Models/Product/Voip.php b/app/Models/Product/Voip.php index 4e3dfaa..68788da 100644 --- a/app/Models/Product/Voip.php +++ b/app/Models/Product/Voip.php @@ -12,7 +12,7 @@ final class Voip extends Type implements ProductItem { protected $table = 'product_voip'; - protected $order_attributes = [ + protected array $order_attributes = [ 'options.phonenumber'=>[ 'request'=>'options.phonenumber', 'key'=>'service_number', diff --git a/app/Models/Service.php b/app/Models/Service.php index 7516537..fee7277 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -18,6 +18,7 @@ use Leenooks\Carbon; use Symfony\Component\HttpKernel\Exception\HttpException; use App\Interfaces\IDs; +use App\Traits\NextKey; /** * Class Service @@ -38,7 +39,7 @@ use App\Interfaces\IDs; // @todo All the methods/attributes in this file need to be checked. class Service extends Model implements IDs { - use HasFactory; + use HasFactory,NextKey; const RECORD_ID = 'service'; public $incrementing = FALSE; @@ -786,7 +787,6 @@ class Service extends Model implements IDs */ public function getProductCategoryAttribute(): string { - abort(500,'deprecated'); return $this->product->getProductTypeAttribute(); } @@ -798,8 +798,7 @@ class Service extends Model implements IDs */ public function getProductNameAttribute(): string { - abort(500,'deprecated'); - return $this->product->name($this->account->language); + return $this->product->getNameAttribute(); } public function getRecurScheduleAttribute($value): int