Skip to content

Commit

Permalink
Merge branch '5.x' into 5.x-update-changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
papac authored Sep 17, 2023
2 parents 1f4396c + 1107ca6 commit c706108
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Database/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ public static function rollback(): void
* Starting the start of a transaction wrapper on top of the callback
*
* @param callable $callback
* @return void
* @return mixed
*/
public static function transaction(callable $callback): mixed
{
Expand Down
21 changes: 20 additions & 1 deletion src/Support/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ function view(string $template, int|array $data = [], int $code = 200)
* @param string $name
* @param string $connexion
* @return Bow\Database\QueryBuilder
* @deprecated
*/
function table(string $name, string $connexion = null)
{
Expand All @@ -182,6 +183,24 @@ function get_last_insert_id(string $name = null)
}
}

if (!function_exists('db_table')) {
/**
* Table alias of DB::table
*
* @param string $name
* @param string $connexion
* @return Bow\Database\QueryBuilder
*/
function db_table(string $name, string $connexion = null)
{
if (is_string($connexion)) {
db($connexion);
}

return DB::table($name);
}
}

if (!function_exists('db_select')) {
/**
* Launches SELECT SQL Queries
Expand Down Expand Up @@ -1454,7 +1473,7 @@ function db_seed(string $name, array $data = []): mixed
}
}

$filename = rtrim(config('app.seeder_path'), '/') . '/' . $name . '_seeder.php';
$filename = rtrim(config('app.seeder_path'), '/') . '/' . $name . '.php';

if (!file_exists($filename)) {
throw new \ErrorException('[' . $name . '] seeder file not found');
Expand Down

0 comments on commit c706108

Please sign in to comment.