Top "Eloquent" questions

The Eloquent ORM included with Laravel provides a beautiful, simple ActiveRecord implementation for working with your database.

How to get distinct values for non-key column fields in Laravel?

This might be quite easy but have no idea how to. I have a table that can have repeated values …

laravel eloquent builder
How to alias a table in Laravel Eloquent queries (or using Query Builder)?

Lets say we are using Laravel's query builder: $users = DB::table('really_long_table_name') ->select('really_long_…

php laravel laravel-4 eloquent
How to insert multiple rows from a single query using eloquent/fluent

I have the following query: $query = UserSubject::where('user_id', Auth::id())->select('subject_id')->get(); …

php sql laravel eloquent
How to delete all the rows in a table using Eloquent?

My guess was to use the following syntax: MyModel::all()->delete(); But that did not work. I'm sure …

laravel laravel-4 eloquent
Laravel 5.2 - pluck() method returns array

I'm trying to upgrade my project L5.1 -> L5.2. In upgrade guide there's one thing which isn't clear for …

php laravel eloquent query-builder laravel-5.2
Laravel Eloquent - Get one Row

This might be a simple question, but I cannot figure this out. I am trying to get a user by …

laravel eloquent
Get the Query Executed in Laravel 3/4

How can I retrieve the raw executed SQL query in Laravel 3/4 using Laravel Query Builder or Eloquent ORM? For example, …

php laravel orm eloquent laravel-query-builder
Why I'm getting 'Non-static method should not be called statically' when invoking a method in a Eloquent model?

Im trying to load my model in my controller and tried this: return Post::getAll(); got the error Non-static method …

php laravel eloquent
Laravel 5 Eloquent where and or in Clauses

i try to get results from table with multiple where and/or clauses. My SQL statement is: SELECT * FROM tbl …

sql laravel eloquent
Is there a way to "limit" the result with ELOQUENT ORM of Laravel?

Is there a way to "limit" the result with ELOQUENT ORM of Laravel? SELECT * FROM `games` LIMIT 30 , 30 And with Eloquent ?

mysql laravel eloquent sql-limit