| Total Complexity | 11 |
| Total Lines | 60 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class Field |
||
| 10 | { |
||
| 11 | use Macroable; |
||
|
|
|||
| 12 | |||
| 13 | /** |
||
| 14 | * Get the current bound registry. |
||
| 15 | */ |
||
| 16 | public static function getRegistry(): TypeRegistry |
||
| 17 | { |
||
| 18 | return resolve(TypeRegistry::class); |
||
| 19 | } |
||
| 20 | |||
| 21 | public static function string(): Fields\Field |
||
| 22 | { |
||
| 23 | return self::getRegistry()->field(self::getRegistry()->string()); |
||
| 24 | } |
||
| 25 | |||
| 26 | public static function int(): Fields\Field |
||
| 27 | { |
||
| 28 | return self::getRegistry()->field(self::getRegistry()->int()); |
||
| 29 | } |
||
| 30 | |||
| 31 | public static function ID(): Fields\Field |
||
| 34 | } |
||
| 35 | |||
| 36 | public static function boolean(): Fields\Field |
||
| 37 | { |
||
| 38 | return self::getRegistry()->field(self::getRegistry()->boolean()); |
||
| 39 | } |
||
| 40 | |||
| 41 | public static function float(): Fields\Field |
||
| 42 | { |
||
| 43 | return self::getRegistry()->field(self::getRegistry()->float()); |
||
| 44 | } |
||
| 45 | |||
| 46 | public static function model(string $class): Fields\EloquentField |
||
| 47 | { |
||
| 48 | return self::getRegistry()->eloquent($class); |
||
| 49 | } |
||
| 50 | |||
| 51 | public static function collection(string $class): Fields\EloquentField |
||
| 52 | { |
||
| 53 | return self::model($class)->list(); |
||
| 54 | } |
||
| 55 | |||
| 56 | public static function type(string $type): Fields\Field |
||
| 57 | { |
||
| 58 | return self::getRegistry()->field($type); |
||
| 59 | } |
||
| 60 | |||
| 61 | public static function list(string $type): Fields\Field |
||
| 64 | } |
||
| 65 | |||
| 66 | public static function polymorphic(array $modelSchemas): PolymorphicField |
||
| 67 | { |
||
| 68 | return self::getRegistry()->polymorphic($modelSchemas); |
||
| 69 | } |
||
| 70 | } |
||
| 71 |