I have two tables, User and Post. One User can have many posts and one post belongs to only one user. In my User model I have a hasMany...
I want to sort multiple columns in Laravel 4 by using the method orderBy() in Laravel Eloquent. The query will be generated using Eloquent like this: SELECT * FROM...
How do I say WHERE (a = 1 OR b =1 ) AND (c = 1 OR d = 1) For more complicated queries am I supposed to use...
I’m using the Laravel Eloquent query builder and I have a query where I want a WHERE clause on multiple conditions. It works, but it’s not elegant. Example: $results...
Given the following code: DB::table('users')->get(); I want to get the raw SQL query string that the database query builder above will generate. In this example, it would be SELECT...