Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ORM/HasAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
*/
trait HasAll
{
public static function all(string $columns = '*'): array
public static function all(string $columns = '*'): Builder
{
return Facades\DB::table(static::table())->select($columns)->toArray();
return Facades\DB::table(static::table())->select($columns);
}
}
}
9 changes: 5 additions & 4 deletions src/ORM/HasFind.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

namespace DatabaseFactory\ORM {

use DatabaseFactory\Facades\DB;

use DatabaseFactory\Builder;
use DatabaseFactory\Facades\DB;

/**
* Allows an entity the ability to return one record
Expand All @@ -16,9 +17,9 @@
*/
trait HasFind
{
public static function find(int $id, string $columns = '*'): array
public static function find(int $id, string $columns = '*'): Builder
{
return DB::table(static::table())->select($columns)->where('id', '=', $id)->toArray();
return DB::table(static::table())->select($columns)->where('id', '=', $id);
}
}
}
7 changes: 4 additions & 3 deletions src/ORM/HasFirst.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

namespace DatabaseFactory\ORM {

use DatabaseFactory\Facades\DB;

use DatabaseFactory\Builder;
use DatabaseFactory\Facades\DB;


/**
Expand All @@ -18,7 +19,7 @@
*/
trait HasFirst
{
public static function first(string $columns = '*'): array
public static function first(string $columns = '*'): Builder
{
return DB::table(static::table())->select($columns)->orderBy('id', 'ASC')->limit(1);
}
Expand Down
9 changes: 5 additions & 4 deletions src/ORM/HasJoin.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

namespace DatabaseFactory\ORM {

use DatabaseFactory\Facades\DB;

use DatabaseFactory\Builder;
use DatabaseFactory\Facades\DB;

/**
* Allows an entity the ability to join tables
Expand All @@ -16,9 +17,9 @@
*/
trait HasJoin
{
public static function join(string $table, array $on, string $columns = '*'): array
public static function join(string $table, array $on, string $columns = '*'): Builder
{
return DB::table(static::table())->join($table, $on, $columns)->toArray();
return DB::table(static::table())->join($table, $on, $columns);
}
}
}
9 changes: 5 additions & 4 deletions src/ORM/HasLast.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

namespace DatabaseFactory\ORM {

use DatabaseFactory\Facades\DB;

use DatabaseFactory\Builder;
use DatabaseFactory\Facades\DB;


/**
Expand All @@ -18,9 +19,9 @@
*/
trait HasLast
{
public static function last(string $columns = '*'): array
public static function last(string $columns = '*'): Builder
{
return DB::table(static::table())->select($columns)->orderBy('id', 'DESC')->limit(1)->toArray();
return DB::table(static::table())->select($columns)->orderBy('id', 'DESC')->limit(1);
}
}
}
4 changes: 2 additions & 2 deletions src/ORM/HasLike.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/
trait HasLike
{
public static function like(string $field, string $pattern, string $columns = '*'): array
public static function like(string $field, string $pattern, string $columns = '*'): Builder
{
return DB::table(static::table())->select($columns)->like($field, $pattern)->toArray();
return DB::table(static::table())->select($columns)->like($field, $pattern);
}
}
}
9 changes: 5 additions & 4 deletions src/ORM/HasNot.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

namespace DatabaseFactory\ORM {

use DatabaseFactory\Facades\DB;

use DatabaseFactory\Builder;
use DatabaseFactory\Facades\DB;

/**
* Allows an entity the ability to return records
Expand All @@ -17,9 +18,9 @@
*/
trait HasNot
{
public static function whereNot($key = null, $value = null, string $columns = '*'): array
public static function whereNot($key = null, $value = null, string $columns = '*'): Builder
{
return DB::table(static::table())->select($columns)->whereNot($key, $value)->toArray();
return DB::table(static::table())->select($columns)->whereNot($key, $value);
}
}
}
9 changes: 5 additions & 4 deletions src/ORM/HasWhere.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

namespace DatabaseFactory\ORM {

use DatabaseFactory\Facades\DB;

use DatabaseFactory\Builder;
use DatabaseFactory\Facades\DB;


/**
Expand All @@ -18,9 +19,9 @@
*/
trait HasWhere
{
public static function where($key, $is = null, $value = null, string $columns = '*'): array
public static function where($key, $is = null, $value = null, string $columns = '*'): Builder
{
return DB::table(static::table())->select($columns)->where($key, $is, $value)->toArray();
return DB::table(static::table())->select($columns)->where($key, $is, $value);
}
}
}