Top "Eloquent" questions

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

Laravel, Datatables, column with relations count

I have two models, User and Training, with Many to many relationship between them. I'm using the Laravel Datatables package …

php laravel datatables eloquent laravel-datatables
How to remove a polymorphic relation in Eloquent?

I have a model like this: <?php class Post extends Eloquent { protected $fillable = []; public function photos() { return $this->…

php laravel eloquent polymorphic-associations
How can I convert json to a Laravel Eloquent Model?

if I have an Eloquent Model called Post, and the mysql table has: integer ID, string Text How do I …

laravel eloquent model-binding
Remove relationship between Eloquent records

I've created two classes extending Eloquent (contacts and tags), they have a ManyToMany relationship. I'm trying to create the method …

laravel-5 eloquent many-to-many laravel-5.1 detach
Method addEagerConstraints does not exist

I have two models, User and Event. I made a pivot table, invitations between User and Event with a status …

laravel eloquent lumen
How can I implement single table inheritance using Laravel's Eloquent?

Currently I have a model class named Post. class Post extends Eloquent { protected $table = 'posts'; protected $fillable = array('user_id', …

mysql inheritance laravel eloquent subclass
Disable eager relations

In my project I have many Eloquent models that have eager relations configured in class like this: protected $with = [ 'countries', …

laravel eloquent eager-loading
Laravel Eloquent ORM - removing rows and all the child relationship, with event deleting

I have three models that relate to each other one to many: Country class Country extends Model { protected $fillable=['name',…

laravel eloquent laravel-events
Laravel seeding results in Null timestamp

So i had a seeder for Languages Table (LanguageTableSeeder) as follows: DB::table('languages')->insert([ 'name' => 'English', …

laravel eloquent laravel-5.4 laravel-seeding
Using limit parameter in paginate function

Is it possible to use 'limit' parameter in paginate() function? I'm trying this: $users->where(...)->limit(50)-&…

laravel eloquent laravel-query-builder laravel-pagination