Normalise usage of Model into Model::class strings

This commit is contained in:
Deon George 2023-05-05 16:29:08 +10:00
parent 820ff2be00
commit dc74a064ba
9 changed files with 18 additions and 18 deletions

View File

@ -20,7 +20,7 @@ class ProductController extends Controller
public function api_supplier_products(Request $request): Collection
{
switch ($request->type) {
case 'App\Models\Product\Broadband':
case Product\Broadband::class:
return Product\Broadband::select(['id','supplier_item_id'])
->with(['supplied.supplier_detail.supplier'])
->get()
@ -28,7 +28,7 @@ class ProductController extends Controller
->sortBy('name')
->values();
case 'App\Models\Product\Domain':
case Product\Domain::class:
return Product\Domain::select(['id','supplier_item_id'])
->with(['supplied.supplier_detail.supplier'])
->get()
@ -36,7 +36,7 @@ class ProductController extends Controller
->sortBy('name')
->values();
case 'App\Models\Product\Email':
case Product\Email::class:
return Product\Email::select(['id','supplier_item_id'])
->with(['supplied.supplier_detail.supplier'])
->get()
@ -44,7 +44,7 @@ class ProductController extends Controller
->sortBy('name')
->values();
case 'App\Models\Product\Generic':
case Product\Generic::class:
return Product\Generic::select(['id','supplier_item_id'])
->with(['supplied.supplier_detail.supplier'])
->get()
@ -52,7 +52,7 @@ class ProductController extends Controller
->sortBy('name')
->values();
case 'App\Models\Product\Host':
case Product\Host::class:
return Product\Host::select(['id','supplier_item_id'])
->with(['supplied.supplier_detail.supplier'])
->get()
@ -60,7 +60,7 @@ class ProductController extends Controller
->sortBy('name')
->values();
case 'App\Models\Product\Phone':
case Product\Phone::class:
return Product\Phone::select(['id','supplier_item_id'])
->with(['supplied.supplier_detail.supplier'])
->get()

View File

@ -39,11 +39,11 @@ class CancelRequest extends Mailable
Config::set('site',$this->service->site);
switch (get_class($this->service->type)) {
case 'App\Models\Service\Broadband':
case Service\Broadband::class:
$subject = sprintf('Cancel BROADBAND: %s',$this->service->type->service_address);
break;
case 'App\Models\Service\Phone':
case Service\Phone::class:
$subject = sprintf('Cancel PHONE: %s',$this->service->type->service_number);
break;

View File

@ -39,11 +39,11 @@ class ChangeRequest extends Mailable
Config::set('site',$this->service->site);
switch (get_class($this->service->type)) {
case 'App\Models\Service\Broadband':
case Service\Broadband::class:
$subject = sprintf('Change BROADBAND: %s',$this->service->type->service_address);
break;
case 'App\Models\Service\Phone':
case Service\Phone::class:
$subject = sprintf('Change PHONE: %s',$this->service->type->service_number);
break;

View File

@ -39,11 +39,11 @@ class OrderRequest extends Mailable
Config::set('site',$this->service->site);
switch (get_class($this->service->type)) {
case 'App\Models\Service\Broadband':
case Service\Broadband::class:
$subject = sprintf('Order BROADBAND: %s',$this->service->type->service_address);
break;
case 'App\Models\Service\Phone':
case Service\Phone::class:
$subject = sprintf('Order PHONE: %s',$this->service->type->service_number);
break;

View File

@ -77,7 +77,7 @@ return [
|
*/
'user' => 'App\Models\User',
'user' => \App\Models\User::class,
/*
|--------------------------------------------------------------------------

View File

@ -29,7 +29,7 @@ class GroupFactory extends Factory
// 'date_expire',
// 'parent_id',
'active' => TRUE,
// 'pricing',
'pricing' => TRUE,
// 'name',
];
}

View File

@ -44,9 +44,9 @@ class ProductFactory extends Factory
]),
// 'price_recur_default'
// 'price_recur_strict'
// 'model_id' => 1,
'model_id' => 1,
// 'accounting'
// 'model' => 'App\Models\Product\Adsl',
'model' => Product\Broadband::class,
];
}

View File

@ -64,7 +64,7 @@ class ServiceFactory extends Factory
// 'ordered_by',
// 'order_status',
// 'order_info',
'model' => 'App\Models\Service\Broadband',
'model' => Service\Broadband::class,
];
}
}

View File

@ -7,7 +7,7 @@
@php
$po = $selected = NULL;
@endphp
@foreach (\App\Models\Product::active()->get()->filter(function($item) { return get_class($item->type) === 'App\Models\Product\Broadband'; })->sortBy('name') as $o)
@foreach (\App\Models\Product::active()->get()->filter(function($item) { return get_class($item->type) === \App\Models\Product\Broadband::class; })->sortBy('name') as $o)
@php
if ($o->id == old('product_id')) {
$selected = 'selected';