Skip to content

[v1.0] Database should support raw statements for multiple methods #7

Description

@marktopper

The Database component should support raw statements for multiple methods, example the where-method.

We use the where-method like this:

$db->table('table')->where('column', 'operator', 'value')->get();

However it needs support for adding raw statements like this:

$db->table('table')->whereRaw("strftime('%Y', `created_at`) = ?", ['2016'])->get();
$db->table('table')->where($db->raw("(SELECT count(id) FROM user_groups WHERE users.id = user_groups.user_id"), '>', 1)->get();

That is my idea on how this should work.

The functions that might require usage of raw statements:

  • where
  • select
  • orderBy
  • groupBy
  • join

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions