22 lines
343 B
PHP
22 lines
343 B
PHP
<?php
|
|
|
|
namespace App\Traits;
|
|
|
|
/**
|
|
* Trait Files
|
|
* This will return a valid Model Object.
|
|
*
|
|
* @package App\Traits
|
|
*/
|
|
trait Type
|
|
{
|
|
private function getModelType(string $type): string
|
|
{
|
|
$class = 'App\Models\\'.ucfirst(strtolower($type));
|
|
|
|
if (! class_exists($class))
|
|
abort(500,sprintf('No class [%s]',$type));
|
|
|
|
return $class;
|
|
}
|
|
} |