photo/app/Traits/Type.php

22 lines
343 B
PHP
Raw Permalink Normal View History

2020-01-02 21:04:15 +00:00
<?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));
2020-01-02 21:04:15 +00:00
if (! class_exists($class))
abort(500,sprintf('No class [%s]',$type));
return $class;
}
}