From e2fd029d4cd536416fd39593cd7664516d488e53 Mon Sep 17 00:00:00 2001 From: JNapolitanoIT Date: Thu, 2 Mar 2023 21:52:22 -0800 Subject: [PATCH] ORM Corrections Corrected return types in ORM modules --- src/ORM/HasAll.php | 2 +- src/ORM/HasFind.php | 2 +- src/ORM/HasFirst.php | 2 +- src/ORM/HasJoin.php | 2 +- src/ORM/HasLast.php | 2 +- src/ORM/HasLike.php | 2 +- src/ORM/HasNot.php | 2 +- src/ORM/HasWhere.php | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ORM/HasAll.php b/src/ORM/HasAll.php index 9401260..075d15d 100644 --- a/src/ORM/HasAll.php +++ b/src/ORM/HasAll.php @@ -17,7 +17,7 @@ */ trait HasAll { - public static function all(string $columns = '*'): Builder + public static function all(string $columns = '*'): array { return Facades\DB::table(static::table())->select($columns)->toArray(); } diff --git a/src/ORM/HasFind.php b/src/ORM/HasFind.php index 32179f5..fefa829 100644 --- a/src/ORM/HasFind.php +++ b/src/ORM/HasFind.php @@ -16,7 +16,7 @@ */ trait HasFind { - public static function find(int $id, string $columns = '*') + public static function find(int $id, string $columns = '*'): array { return DB::table(static::table())->select($columns)->where('id', '=', $id)->toArray(); } diff --git a/src/ORM/HasFirst.php b/src/ORM/HasFirst.php index eed1484..c645143 100644 --- a/src/ORM/HasFirst.php +++ b/src/ORM/HasFirst.php @@ -18,7 +18,7 @@ */ trait HasFirst { - public static function first(string $columns = '*') + public static function first(string $columns = '*'): array { return DB::table(static::table())->select($columns)->orderBy('id', 'ASC')->limit(1); } diff --git a/src/ORM/HasJoin.php b/src/ORM/HasJoin.php index 5d9bf8c..5a8ddd7 100644 --- a/src/ORM/HasJoin.php +++ b/src/ORM/HasJoin.php @@ -16,7 +16,7 @@ */ trait HasJoin { - public static function join(string $table, array $on, string $columns = '*') + public static function join(string $table, array $on, string $columns = '*'): array { return DB::table(static::table())->join($table, $on, $columns)->toArray(); } diff --git a/src/ORM/HasLast.php b/src/ORM/HasLast.php index 8541b80..9902b51 100644 --- a/src/ORM/HasLast.php +++ b/src/ORM/HasLast.php @@ -18,7 +18,7 @@ */ trait HasLast { - public static function last(string $columns = '*') + public static function last(string $columns = '*'): array { return DB::table(static::table())->select($columns)->orderBy('id', 'DESC')->limit(1)->toArray(); } diff --git a/src/ORM/HasLike.php b/src/ORM/HasLike.php index fb7aedd..1d8ed46 100644 --- a/src/ORM/HasLike.php +++ b/src/ORM/HasLike.php @@ -18,7 +18,7 @@ */ trait HasLike { - public static function like(string $field, string $pattern, string $columns = '*'): Builder + public static function like(string $field, string $pattern, string $columns = '*'): array { return DB::table(static::table())->select($columns)->like($field, $pattern)->toArray(); } diff --git a/src/ORM/HasNot.php b/src/ORM/HasNot.php index af585f1..883ad12 100644 --- a/src/ORM/HasNot.php +++ b/src/ORM/HasNot.php @@ -17,7 +17,7 @@ */ trait HasNot { - public static function whereNot($key = null, $value = null, string $columns = '*') + public static function whereNot($key = null, $value = null, string $columns = '*'): array { return DB::table(static::table())->select($columns)->whereNot($key, $value)->toArray(); } diff --git a/src/ORM/HasWhere.php b/src/ORM/HasWhere.php index c29e119..02fa2c4 100644 --- a/src/ORM/HasWhere.php +++ b/src/ORM/HasWhere.php @@ -18,7 +18,7 @@ */ trait HasWhere { - public static function where($key, $is = null, $value = null, string $columns = '*') + public static function where($key, $is = null, $value = null, string $columns = '*'): array { return DB::table(static::table())->select($columns)->where($key, $is, $value)->toArray(); }