Top "Eloquent" questions

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

Laravel - Eager Loading Polymorphic Relation's Related Models

I can eager load polymorphic relations/models without any n+1 issues. However, if I try to access a model related …

laravel eloquent polymorphic-associations eager-loading polymorphism
How to save entries in many to many polymorphic relationship in Laravel?

I have an Org model and a Tag model. I want to associate tags with organizations. My database tables and …

laravel-4 eloquent polymorphic-associations
Insert data to a pivot table in laravel

I have 3 tables: posts, tags, post_tag. Each Post has many tags so I use hasMany method for them. But …

php laravel eloquent pivot-table
Laravel Pagination with eloquent Queries

I am trying to paginate my template which has a table on it. This is my function in the controller …

laravel-4 eloquent blade laravel-paginate
Left join to get a single row in Laravel

I have been unsuccessfully trying to leftjoin and get the required data Here is my code: $album = Albums::->…

php sql laravel-4 eloquent query-builder
Where NOT in pivot table

In Laravel we can setup relationships like so: class User { public function items() { return $this->belongsToMany('Item'); } } Allowing us …

laravel laravel-4 pivot-table eloquent
Laravel: find if a pivot table record exists

I have two models which are joined by a pivot table, User and Task. I have a user_id and …

php laravel eloquent pivot-table
Laravel: Returning the namespaced owner of a polymorphic relation

I can find a number of discussions regarding this but no clear solution. Here are two links, although I will …

laravel laravel-4 polymorphism eloquent
Case-sensitive where statement in laravel

How can I do a case-sensitive string match with laravel? SELECT * FROM `invites` WHERE `token`='OGwie2e2985tOEGewgu23hUFs' Can …

php mysql laravel-4 eloquent case-sensitive
Mocking Laravel Eloquent models - how to set a public property with Mockery

I want to use a mock object (Mockery) in my PHPUnit test. The mock object needs to have both some …

php laravel eloquent mockery