Skip to content

Instantly share code, notes, and snippets.

@dsomel21
Created March 6, 2017 15:54
Show Gist options
  • Save dsomel21/ab908be6abf41ae6d74d2d69a09a3d46 to your computer and use it in GitHub Desktop.
Save dsomel21/ab908be6abf41ae6d74d2d69a09a3d46 to your computer and use it in GitHub Desktop.
Params vs. no params
>>> $artist->fresh()->albums()->first();
string(46) "select * from "artists" where "id" = ? limit 1"
string(98) "select * from "albums" where "albums"."artist_id" = ? and "albums"."artist_id" is not null limit 1"
=> App\Album {#668
id: "1",
artist_id: "2",
album_name: "Yeezus",
created_at: "2017-03-06 15:22:37",
updated_at: "2017-03-06 15:22:37",
}
>>> $artist->fresh()->albums->first();
string(46) "select * from "artists" where "id" = ? limit 1"
string(90) "select * from "albums" where "albums"."artist_id" = ? and "albums"."artist_id" is not null"
=> App\Album {#658
id: "1",
artist_id: "2",
album_name: "Yeezus",
created_at: "2017-03-06 15:22:37",
updated_at: "2017-03-06 15:22:37",
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment