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
|
|
|
|
{
|
2024-08-31 12:23:07 +00:00
|
|
|
$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;
|
|
|
|
}
|
|
|
|
}
|