| Total Complexity | 6 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | trait MakeInstance |
||
| 6 | { |
||
| 7 | public $instance; |
||
| 8 | |||
| 9 | public function __construct($identifier) |
||
| 10 | { |
||
| 11 | if (is_string($identifier) || is_int($identifier)) { |
||
| 12 | $this->instance = $this->getModel()::query() |
||
| 13 | ->with('type') |
||
| 14 | ->findByHashSlugOrId($identifier); |
||
| 15 | } |
||
| 16 | |||
| 17 | if (is_object($identifier)) { |
||
| 18 | $this->instance($identifier); |
||
| 19 | } |
||
| 20 | } |
||
| 21 | |||
| 22 | public static function make($identifier) |
||
| 25 | } |
||
| 26 | |||
| 27 | public function instance($instance) |
||
| 32 | } |
||
| 33 | |||
| 34 | abstract public function getModel(); |
||
| 35 | } |
||
| 36 |