Top "Eloquent" questions

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

truncate all tables in laravel using eloquent

Is there a way I could truncate all the tables in a db using eloquent or fluent in laravel 4? I …

php database laravel eloquent fluent
Laravel Eloquent: eager loading of multiple nested relationships

What laravel says: $books = App\Book::with('author.contacts')->get(); What I need is something like this $books = …

laravel eloquent eager-loading
PHP Lumen Call to a member function connection() on null

Call to a member function connection() on null is the error I'm receiving when trying to use an Eloquent Model …

php laravel eloquent lumen
Get previous attribute value in Eloquent model event

Is there a way to see the old/previous value of a model's attribute in its saving or updating event? …

php laravel laravel-4 eloquent
Argument 1 passed must be an instance of App\Request, instance of Illuminate\Http\Request given

I have created a method in my User model to upload a poster (with intervention)for the user: /** * Store user's …

laravel eloquent request image-uploading intervention
Array_unique on a laravel eloquent collection

Not sure if this is possible but im trying to run array_unique over a collection of items i have, …

php laravel laravel-4 eloquent array-unique
Implementing group_by and having in Laravel using Eloquent

I am having trouble implementing the group_by and having queries using Eloquent in Laravel. Here is the scenario: orders …

php group-by laravel eloquent having
Timestamps are not updating while attaching data in pivot table

I'm creating a row in pivot table using the following attach statement. $music = Music::find(1); $music->users()->…

laravel laravel-4 eloquent
SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias on relationship

So, I'm receiving the following error from Laravel framework; but I couldn't find why this framework is producing this error: …

mysql laravel eloquent laravel-4 relationship
Get ids array from related laravel model which is having belongsToMany relationship

I have a model Role which belongs to many Users. Class Role { public $fillable = ["name"]; public function users() { return $this-&…

php mysql laravel eloquent relationship