Start of console commands enhancements
This commit is contained in:
22
app/Traits/Type.php
Normal file
22
app/Traits/Type.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?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\\'.$type;
|
||||
|
||||
if (! class_exists($class))
|
||||
abort(500,sprintf('No class [%s]',$type));
|
||||
|
||||
return $class;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user