Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update helpers.php #257

Merged
merged 2 commits into from
Sep 17, 2023
Merged
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
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
Loading